|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
784 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | import isAbsoluteURL from '../helpers/isAbsoluteURL.js';
|
|---|
| 4 | import combineURLs from '../helpers/combineURLs.js';
|
|---|
| 5 |
|
|---|
| 6 | /**
|
|---|
| 7 | * Creates a new URL by combining the baseURL with the requestedURL,
|
|---|
| 8 | * only when the requestedURL is not already an absolute URL.
|
|---|
| 9 | * If the requestURL is absolute, this function returns the requestedURL untouched.
|
|---|
| 10 | *
|
|---|
| 11 | * @param {string} baseURL The base URL
|
|---|
| 12 | * @param {string} requestedURL Absolute or relative URL to combine
|
|---|
| 13 | *
|
|---|
| 14 | * @returns {string} The combined full path
|
|---|
| 15 | */
|
|---|
| 16 | export default function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|---|
| 17 | let isRelativeUrl = !isAbsoluteURL(requestedURL);
|
|---|
| 18 | if (baseURL && (isRelativeUrl || allowAbsoluteUrls === false)) {
|
|---|
| 19 | return combineURLs(baseURL, requestedURL);
|
|---|
| 20 | }
|
|---|
| 21 | return requestedURL;
|
|---|
| 22 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.