Skip to content

Commit 533188b

Browse files
committed
fix: encode store name on Windows
1 parent d746898 commit 533188b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { createReadStream, createWriteStream, promises as fs } from 'node:fs'
33
import http from 'node:http'
44
import { tmpdir } from 'node:os'
55
import { dirname, join, relative, resolve, sep } from 'node:path'
6+
import { platform } from 'node:process'
67

78
import { ListResponse } from './backend/list.ts'
89
import { decodeMetadata, encodeMetadata, METADATA_HEADER_INTERNAL } from './metadata.ts'
@@ -301,12 +302,15 @@ export class BlobsServer {
301302
return {}
302303
}
303304

304-
const [, siteID, storeName, ...key] = url.pathname.split('/')
305+
const [, siteID, rawStoreName, ...key] = url.pathname.split('/')
305306

306-
if (!siteID || !storeName) {
307+
if (!siteID || !rawStoreName) {
307308
return {}
308309
}
309310

311+
// On Windows, file paths can't include the `:` character, which is used in
312+
// deploy-scoped stores.
313+
const storeName = platform === 'win32' ? encodeURIComponent(rawStoreName) : rawStoreName
310314
const rootPath = resolve(this.directory, 'entries', siteID, storeName)
311315
const dataPath = resolve(rootPath, ...key)
312316
const metadataPath = resolve(this.directory, 'metadata', siteID, storeName, ...key)

0 commit comments

Comments
 (0)