Merge pull request #2772 from overleaf/revert-2767-spd-oio-moreurls

Revert "Add support for data urls and snip arrays to Open-in-Overleaf"

GitOrigin-RevId: c1e3806686764553d8801517b913f9133642fdb2
This commit is contained in:
Simon Detheridge
2020-04-24 10:22:47 +01:00
committed by Copybot
parent f84ef4e999
commit 7c00b2d838
4 changed files with 697 additions and 733 deletions
@@ -1,6 +1,5 @@
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
@@ -15,11 +14,6 @@ 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')
@@ -28,7 +22,7 @@ const UrlHelper = {
},
prependHttpIfNeeded(url) {
if (!url.match('://') && !isDataUrl(url)) {
if (!url.match('://')) {
url = `http://${url}`
}
return url
@@ -16,7 +16,6 @@ const uuid = require('uuid')
const _ = require('underscore')
const Settings = require('settings-sharelatex')
const request = require('request')
const parseDataUrl = require('parse-data-url')
const { promisifyAll } = require('../util/promises')
const FileWriter = {
@@ -105,16 +104,6 @@ const FileWriter = {
callback = function(error, fsPath) {}
}
callback = _.once(callback)
const dataUrl = parseDataUrl(url)
if (dataUrl) {
return FileWriter.writeContentToDisk(
identifier,
dataUrl.toBuffer(),
callback
)
}
const stream = request.get(url)
stream.on('error', function(err) {
logger.warn(
+696 -713
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -92,7 +92,6 @@
"oauth2-server": "^3.0.1",
"otplib": "^12.0.1",
"p-limit": "^2.3.0",
"parse-data-url": "^2.0.0",
"passport": "^0.4.1",
"passport-google-oauth20": "^2.0.0",
"passport-local": "^1.0.0",
@@ -118,7 +117,6 @@
"url-parse": "^1.4.7",
"utf-8-validate": "^5.0.2",
"uuid": "^3.0.1",
"valid-data-url": "^2.0.0",
"valid-url": "^1.0.9",
"xml2js": "^0.4.22",
"xregexp": "^4.3.0",