Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 262286 Details for
Bug 495622
The node server crashes when trying to import the attached zip file
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Proposed patch
495622.patch (text/plain), 3.08 KB, created by
Olivier Thomann
on 2016-06-07 16:17:49 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2016-06-07 16:17:49 EDT
Size:
3.08 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js b/bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js >index 2cb0325..0c333e8 100644 >--- a/bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js >+++ b/bundles/org.eclipse.orion.client.ui/web/orion/fileCommands.js >@@ -133,6 +133,12 @@ define(['i18n!orion/navigate/nls/messages', 'orion/webui/littlelib', 'orion/i18n > return; > } > } >+ if (result.Severity === "Error") { >+ if (handlers && handlers.error) { >+ handlers.error(); >+ return; >+ } >+ } > } > if (!preventNotification) { > //TODO Not sure if we should send out event from file Client here >diff --git a/modules/orionode/lib/xfer.js b/modules/orionode/lib/xfer.js >index cb6dd8f..e19e68f 100644 >--- a/modules/orionode/lib/xfer.js >+++ b/modules/orionode/lib/xfer.js >@@ -22,9 +22,9 @@ var mkdirp = require('mkdirp'); > var fs = Promise.promisifyAll(require('fs')); > var fileUtil = require('./fileUtil'); > >-/** >- * @callback >- */ >+/** >+ * @callback >+ */ > module.exports = function(options) { > var UPLOADS_FOLDER = path.join(options.configParams['orion.single.user'] ? > path.join(os.homedir(), ".orion") : options.workspaceDir, ".uploads"); >@@ -41,6 +41,20 @@ module.exports = function(options) { > function getOptions(req) { > return req.get("X-Xfer-Options").split(","); > } >+ >+function reportTransferFailure(res, err) { >+ var message = "File transfer failed"; >+ if (err.message) { >+ message += ": " + err.message; >+ } >+ return res.status(400).json({ >+ Severity: "Error", >+ HttpCode: 400, >+ Code: 0, >+ Message: message, >+ DetailedMessage: message >+ }); >+} > > function postImportXfer(req, res) { > var filePath = req.params["0"]; >@@ -63,6 +77,9 @@ function postImportXfer(req, res) { > function upload(request) { > var tempFile = path.join(UPLOADS_FOLDER, Date.now() + fileName); > var ws = fs.createWriteStream(tempFile); >+ ws.on('error', function(err) { >+ reportTransferFailure(res, err); >+ }); > ws.on('finish', function() { > completeTransfer(req, res, tempFile, filePath, fileName, xferOptions, shouldUnzip); > }); >@@ -142,9 +159,20 @@ function completeTransfer(req, res, tempFile, filePath, fileName, xferOptions, s > entry.autodrain(); > return; > } >- entry.pipe(fs.createWriteStream(outputName)); >+ // make sure all sub folders exist >+ var subfolderPath = path.join(filePath, path.dirname(entryName)); >+ if (!fs.existsSync(subfolderPath)) { >+ mkdirp.sync(subfolderPath); >+ } >+ var writeStream = fs.createWriteStream(outputName); >+ writeStream.on('error', function(err) { >+ reportTransferFailure(res, err); >+ }); >+ entry.pipe(writeStream); > } else if (type === "Directory") { >- mkdirp.sync(outputName); >+ if (!fs.existsSync(outputName)) { >+ mkdirp.sync(outputName); >+ } > } > } else { > entry.autodrain(); >@@ -210,4 +238,4 @@ function write (zip, base, filePath) { > zip.file(filePath, { name: filePath.substring(base.length).replace(/\\/g, "/") }); > }); > } >-}; >+};
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 495622
:
262285
| 262286