Univention Bugzilla – Attachment 4983 Details for
Bug 29960
MultiUploader and Uploader error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for MultiUploader and umc/tools:parseError()
umc-MultiUploader-tools_parseError.patch (text/plain), 2.16 KB, created by
Alexander Kläser
on 2013-01-14 13:29:45 CET
(
hide
)
Description:
Patch for MultiUploader and umc/tools:parseError()
Filename:
MIME Type:
Creator:
Alexander Kläser
Created:
2013-01-14 13:29:45 CET
Size:
2.16 KB
patch
obsolete
>Index: umc/tools.js >=================================================================== >--- umc/tools.js (Revision 38264) >+++ umc/tools.js (Arbeitskopie) >@@ -533,6 +533,24 @@ > 591: _( 'Could not process the request.' ) > }, > >+ _parseStatus: function(stat) { >+ if (typeof stat == 'number') { >+ // easy -> stat is a number >+ return stat; >+ } >+ if (typeof stat == 'string') { >+ // stat is a string, i.e., it could be "400" or "400 Bad Request"... try to parse it >+ try { >+ return parseInt(stat, 10); >+ } catch(error) { >+ // parsing failed -> return 0 as fallback >+ return 0; >+ } >+ } >+ // return 0 as fallback >+ return 0; >+ }, >+ > parseError: function(error) { > var status = error.status !== undefined ? error.status : 500; > var message = this._statusMessages[status] || this._statusMessages[500]; >@@ -549,7 +567,7 @@ > } > if (error.response.data) { > // the response contained a valid JSON object, which contents is already html escaped >- status = error.response.data.status && parseInt(error.response.data.status, 10) || status; >+ status = error.response.data.status && this._parseStatus(error.response.data.status) || status; > message = error.response.data.message || ''; > result = error.response.data.result || null; > } else { >@@ -566,10 +584,14 @@ > result = error.data.result || null; > } else if(error.text) { > message = r.test(error.text) ? r.exec(error.text)[1] : error.text; >+ } else if(error.message && error.status) { >+ // Uploader: errors are returned as simple JSON object { status: "XXX ...", message: "..." } >+ message = error.message; >+ status = error.status; > } > > return { >- status: parseInt(status, 10), >+ status: this._parseStatus(status), > message: String(message).replace(/\n/g, '<br>'), > result: result > }; >Index: umc/widgets/MultiUploader.js >=================================================================== >--- umc/widgets/MultiUploader.js (Revision 38264) >+++ umc/widgets/MultiUploader.js (Arbeitskopie) >@@ -144,6 +144,7 @@ > }, > > _setValueAttr: function(newVal) { >+ this._files.selection.clear(); > this._files.set('staticValues', newVal); > }, >
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 29960
: 4983