chore: initial import
This commit is contained in:
10
utils/common.js
Normal file
10
utils/common.js
Normal file
@@ -0,0 +1,10 @@
|
||||
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}`
|
||||
}
|
||||
Reference in New Issue
Block a user