Skip to content

Commit 884c3d1

Browse files
authored
Fix script file upload from *formidable* migration (#1950)
* Retested lib and userscript on dev Post #1949 NOTE: * *formidable* can't easily be "poor mans debugged" via `console.log(script)`. Must use `JSON.stringify(script)` to avoid throw * Ref https://github.com/node-formidable/formidable/blob/2815e914a6d2465e5fa1c52f09c1dcd77a544659/README.md#file Auto-merge
1 parent bc9e50f commit 884c3d1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controllers/user.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,9 +2028,9 @@ exports.uploadScript = function (aReq, aRes, aNext) {
20282028

20292029
// Reject non-js file
20302030
if (isDev) {
2031-
console.log('Upload Script MIME Content-Type is `' + script.type + '`');
2031+
console.log('Upload Script MIME Content-Type is `' + script.mimetype + '`');
20322032
}
2033-
switch (script.type) {
2033+
switch (script.mimetype) {
20342034
case 'application/x-javascript': // #872 #1661
20352035
case 'application/javascript': // #1599
20362036
case 'text/javascript': // Default
@@ -2054,7 +2054,7 @@ exports.uploadScript = function (aReq, aRes, aNext) {
20542054
return;
20552055
}
20562056

2057-
stream = fs.createReadStream(script.path);
2057+
stream = fs.createReadStream(script.filepath);
20582058

20592059
stream.on('error', function(aErr) {
20602060
msg = 'Upload Script failed.';

0 commit comments

Comments
 (0)