1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-21 16:41:24 +02:00

Fix invalid URL being generated

This commit is contained in:
Kamran Ahmed
2019-11-13 23:44:45 +04:00
parent 4b8799bed7
commit f9579eea4b

View File

@@ -2,7 +2,9 @@ import queryString from 'query-string';
import siteConfig from 'storage/site'; import siteConfig from 'storage/site';
export const prefixHost = (url) => { export const prefixHost = (url) => {
return /^\//.test(url) ? `${siteConfig.url}${url}` : url; // if it starts with forward slash then prefix site URL
// @todo proper handling of full URLs and trailing slashes
return /^\//.test(url) ? `${siteConfig.url.web}${url}` : url;
}; };
export const getTwitterUrl = (username) => { export const getTwitterUrl = (username) => {