Fix getPublicUrl to handle relative and absolute URLs
This commit is contained in:
parent
3110cab18f
commit
396768da7b
1 changed files with 5 additions and 1 deletions
|
@ -119,7 +119,11 @@ function getUrlObject(req) {
|
|||
*/
|
||||
export function getPublicUrl(publicUrl, req) {
|
||||
if (publicUrl) {
|
||||
return publicUrl;
|
||||
try {
|
||||
return new URL(publicUrl).toString();
|
||||
} catch {
|
||||
return new URL(publicUrl, getUrlObject(req)).toString();
|
||||
}
|
||||
}
|
||||
return getUrlObject(req).toString();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue