Escape hyphens in version ids #810 (#860)

Hyphens are typically used by MinIO in version ids (these are uuids).
We need to escape them as they are not included in the path to load a document
after bcb9740
This commit is contained in:
Florent 2024-02-20 16:46:38 +01:00 committed by GitHub
parent d8048c3998
commit af676642d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1038,7 +1038,7 @@ export function buildUrlId(parts: UrlIdParts): string {
// may be in a docId (leaving just the hyphen, which is permitted). The limits // may be in a docId (leaving just the hyphen, which is permitted). The limits
// could be loosened, but without much benefit. // could be loosened, but without much benefit.
const codedSnapshotId = encodeURIComponent(parts.snapshotId) const codedSnapshotId = encodeURIComponent(parts.snapshotId)
.replace(/[_.!~*'()]/g, ch => `_${ch.charCodeAt(0).toString(16).toUpperCase()}`) .replace(/[_.!~*'()-]/g, ch => `_${ch.charCodeAt(0).toString(16).toUpperCase()}`)
.replace(/%/g, '_'); .replace(/%/g, '_');
token = `${token}~v=${codedSnapshotId}`; token = `${token}~v=${codedSnapshotId}`;
} }