mirror of
https://github.com/The-Low-Code-Foundation/OpenNoodl.git
synced 2026-01-12 15:22:55 +01:00
Initial commit
Co-Authored-By: Eric Tuvesson <eric.tuvesson@gmail.com> Co-Authored-By: mikaeltellhed <2311083+mikaeltellhed@users.noreply.github.com> Co-Authored-By: kotte <14197736+mrtamagotchi@users.noreply.github.com> Co-Authored-By: Anders Larsson <64838990+anders-topp@users.noreply.github.com> Co-Authored-By: Johan <4934465+joolsus@users.noreply.github.com> Co-Authored-By: Tore Knudsen <18231882+torekndsn@users.noreply.github.com> Co-Authored-By: victoratndl <99176179+victoratndl@users.noreply.github.com>
This commit is contained in:
17
packages/noodl-runtime/src/utils.js
Normal file
17
packages/noodl-runtime/src/utils.js
Normal file
@@ -0,0 +1,17 @@
|
||||
//this just assumes the base url is '/' always
|
||||
function getAbsoluteUrl(_url) {
|
||||
|
||||
//convert to string in case the _url is a Cloud File (which is an object with a custom toString())
|
||||
const url = String(_url);
|
||||
|
||||
//only add a the base url if this is a local URL (e.g. not a https url or base64 string)
|
||||
if (!url || url[0] === "/" || url.includes("://") || url.startsWith('data:')) {
|
||||
return url;
|
||||
}
|
||||
|
||||
return (Noodl.baseUrl || '/') + url;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getAbsoluteUrl
|
||||
};
|
||||
Reference in New Issue
Block a user