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