This commit is contained in:
Admin 2025-08-14 14:08:12 +07:00
parent dbdbf58339
commit 83e08f386c
2 changed files with 4 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

View File

@ -15,12 +15,13 @@ export class Product extends CoreEntity {
const prefix = process.env.PREFIX_VERSION || '/api';
const port = process.env.APP_PORT || '4000';
return (value as []).map((item) => {
if (isURL(item, { require_host: true, require_protocol: true })) {
return (value as string[]).map((item) => {
// Nếu đã là URL đầy đủ thì trả về nguyên xi
if (/^https?:\/\//i.test(item)) {
return item;
}
const path = `medias/products/${(title as string).toLowerCase().replaceAll(' ', '-')}/${item}`;
const path = `medias/products/${title.toLowerCase().replaceAll(' ', '-')}/${item}`;
if (env === 'dev') {
return `http://localhost:${port}${prefix}/${path}`;