Skip to content

Commit fa12025

Browse files
committed
publich files fetch
1 parent 9228aeb commit fa12025

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
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.6.16",
3+
"version": "0.6.17",
44
"license": "Apache-2.0",
55
"exports": {
66
".": "./mod.ts",

src/files/public-files-handler.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ export const publicFilesHandler: PathHandler = {
88
match: /^\/files\/(.+)$/,
99
async handler(inCloud, inRequest, inResponse) {
1010
const thumbnail = inRequest.params.get("thumbnail");
11-
const accountAndFileId = inRequest.path.replace(/^\/files\//, "") +
12-
thumbnail
13-
? "/thumb"
14-
: "";
11+
let accountAndFileId = inRequest.path.replace(/^\/files\//, "");
12+
if (thumbnail) {
13+
accountAndFileId = accountAndFileId += "-thumb";
14+
}
1515
if (!accountAndFileId) {
1616
raiseServerException(404, "File not found");
1717
}
@@ -25,7 +25,7 @@ export const publicFilesHandler: PathHandler = {
2525
for await (const item of Deno.readDir(accontFolder)) {
2626
if (
2727
item.isFile &&
28-
item.name.startsWith(`${fileId}${thumbnail ? "-thumb" : ""}.`)
28+
item.name.startsWith(`${fileId}.`)
2929
) {
3030
filePath = joinPath(accountId, item.name);
3131
inCloud.inCache.setValue("publicFiles", accountAndFileId, filePath);

0 commit comments

Comments
 (0)