mirror of
https://github.com/rustfs/console.git
synced 2026-08-29 03:52:28 +08:00
10 lines
401 B
JavaScript
10 lines
401 B
JavaScript
export function normalizeUploadPrefix(prefix) {
|
|
return prefix.trim().replace(/^\/+/, "").replace(/\/+$/, "")
|
|
}
|
|
|
|
export function buildUploadObjectKey(prefix, relativePath) {
|
|
const normalizedPrefix = normalizeUploadPrefix(prefix)
|
|
const normalizedRelativePath = relativePath.replace(/^\/+/, "")
|
|
return normalizedPrefix ? `${normalizedPrefix}/${normalizedRelativePath}` : normalizedRelativePath
|
|
}
|