Cleaned up TODOs from file (#1478)

This commit is contained in:
Ssensalo Edgar 2021-10-08 01:22:23 +03:00 committed by GitHub
parent db8d91f889
commit fa6b486572
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -236,27 +236,6 @@ class OctoClient {
// Hydrate is important, as it ensures that each block is complete to the current model // Hydrate is important, as it ensures that each block is complete to the current model
const fixedBlocks = OctoUtils.hydrateBlocks(blocks) const fixedBlocks = OctoUtils.hydrateBlocks(blocks)
// !TODO: Remove this fixup code
for (const block of fixedBlocks) {
if (!block.fields) {
block.fields = {}
}
if (block.type === 'image') {
if (!block.fields.fileId && block.fields.url) {
// Convert deprecated url to fileId
try {
const url = new URL(block.fields.url)
const path = url.pathname
const fileId = path.substring(path.lastIndexOf('/') + 1)
block.fields.fileId = fileId
} catch {
Utils.logError(`Failed to get fileId from url: ${block.fields.url}`)
}
}
}
}
return fixedBlocks return fixedBlocks
} }
@ -386,7 +365,6 @@ class OctoClient {
Utils.log(`uploadFile response: ${text}`) Utils.log(`uploadFile response: ${text}`)
const json = JSON.parse(text) const json = JSON.parse(text)
// const json = await this.getJson(response)
return json.fileId return json.fileId
} catch (e) { } catch (e) {
Utils.logError(`uploadFile json ERROR: ${e}`) Utils.logError(`uploadFile json ERROR: ${e}`)