Skip to content

Commit 4d5ee17

Browse files
committed
fix: wait for file optimization
1 parent bbbbd6f commit 4d5ee17

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@inspatial/cloud",
3-
"version": "0.7.10",
3+
"version": "0.7.11",
44
"license": "Apache-2.0",
55
"exports": {
66
".": "./mod.ts",

src/files/actions/get-file.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export const getFile = new CloudAPIAction("getFile", {
3535
global ? "globalCloudFile" : "cloudFile",
3636
fileId,
3737
);
38+
if (file.$optimizeImage && !file.$optimized) {
39+
raiseServerException(404, "File not optimized yet");
40+
}
3841
let fileName = "";
3942
if (thumbnail) {
4043
fileName = file.$thumbnailPath

src/files/image-ops/resize-worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const commandHandlers: {
105105
}
106106
const outputFilePath = filePath.replace(
107107
/\.[^.]+$/,
108-
`.${format === "jpeg" ? "jpg" : "png"}`,
108+
`.${format === "png" ? "png" : "jpg"}`,
109109
);
110110

111111
await Deno.writeFile(outputFilePath, resized);

src/in-queue/in-queue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ export class InQueue extends InCloud {
230230
}
231231
if (result.thumbnailPath) {
232232
fileEntry.$thumbnailPath = result.thumbnailPath;
233+
fileEntry.$hasThumbnail = true;
233234
}
234235
fileEntry.$fileSize = result.fileSize;
235236
fileEntry.$fileExtension = format;

0 commit comments

Comments
 (0)