11 lines
300 B
JavaScript
11 lines
300 B
JavaScript
import { config } from '../config.js'
|
|
|
|
export function addFilePrefix(url = '') {
|
|
const value = String(url || '').trim()
|
|
if (!value) return ''
|
|
if (/^(https?:\/\/|data:image|blob:)/i.test(value)) {
|
|
return value
|
|
}
|
|
return `${config.filePrefix}${value.startsWith('/') ? '' : '/'}${value}`
|
|
}
|