|
|
@@ -1,5 +1,6 @@
|
|
|
const Settings = require('settings-sharelatex')
|
|
|
const { URL } = require('url')
|
|
|
+const isDataUrl = require('valid-data-url')
|
|
|
|
|
|
function getSafeRedirectPath(value) {
|
|
|
const baseURL = Settings.siteUrl // base URL is required to construct URL from path
|
|
|
@@ -14,6 +15,11 @@ function getSafeRedirectPath(value) {
|
|
|
const UrlHelper = {
|
|
|
getSafeRedirectPath,
|
|
|
wrapUrlWithProxy(url) {
|
|
|
+ // we already have the data for data URLs
|
|
|
+ if (isDataUrl(url)) {
|
|
|
+ return url
|
|
|
+ }
|
|
|
+
|
|
|
// TODO: Consider what to do for Community and Enterprise edition?
|
|
|
if (!Settings.apis.linkedUrlProxy.url) {
|
|
|
throw new Error('no linked url proxy configured')
|
|
|
@@ -22,7 +28,7 @@ const UrlHelper = {
|
|
|
},
|
|
|
|
|
|
prependHttpIfNeeded(url) {
|
|
|
- if (!url.match('://')) {
|
|
|
+ if (!url.match('://') && !isDataUrl(url)) {
|
|
|
url = `http://${url}`
|
|
|
}
|
|
|
return url
|