forked from instructure/canvas-rce-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates dependencies that have outstanding CVEs reported by npm audit. Specifically: - Bumped node-jose from 1.x to 2.x due to critical vuln - Replaced request and request-promise-native with node-fetch since the former is deprecated - Replaced isomorphic-fetch polyfill with node-fetch (recommended by unsplash-js and isomorphic-fetch was already using node-fetch) - Bumped morgan from 1.9.0 to 1.10.0 due to moderate vuln Leaving dev dependencies alone for now, except for: - Bumped mocha from 5.2.0 to 8.2.1 for better configuration support Also note that we are now attaching fetch to the global object since unsplash-js requires it to be there. closes LS-1523 flag = rce_enhancements Test plan: Ensure that all interactions between both old RCE and new RCE with the RCS still work as expected. Specifically: - Viewing/adding/editing links to: * Pages * Assignments * Quizzes * Announcements * Discussions * Modules - Viewing and uploading files - Viewing and uploading images - Searching for and inserting images from Flickr (old RCE only) - Searching for and inserting images from Unsplash - Viewing, recording, and uploading media via Kaltura - Searching for and inserting YouTube videos (old RCE only) Change-Id: I585b86b87ae2e6cdb16dc3d12062959ec78c5565 Reviewed-on: https://gerrit.instructure.com/c/canvas-rce-api/+/254605 Tested-by: Service Cloud Jenkins <[email protected]> Reviewed-by: Ed Schiebel <[email protected]> QA-Review: Ed Schiebel <[email protected]> Product-Review: Jeff Largent <[email protected]>
- Loading branch information
Showing
12 changed files
with
840 additions
and
525 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
|
||
// Translates a fetch-style response into a request-style | ||
// response that the proxied routes expect. Specifically, | ||
// we need to be able to read the body and the headers from | ||
// the same object, which fetch doesn't support by default. | ||
function parseFetchResponse(res) { | ||
return res | ||
.text() | ||
.then(text => { | ||
// Try to parse response body as JSON, if it wasn't JSON | ||
// then default to text representation (including blank). | ||
try { | ||
return JSON.parse(text); | ||
} catch (err) { | ||
return text; | ||
} | ||
}) | ||
.then(data => ({ | ||
body: data, | ||
headers: res.headers.raw(), | ||
statusCode: res.status | ||
})); | ||
} | ||
|
||
module.exports = { parseFetchResponse }; |
Oops, something went wrong.