Escape FTP filename. Thanks @yhoogstrate

This commit is contained in:
Dannon Baker
2017-03-07 07:43:45 -05:00
parent b8b7739292
commit 006801ba1a
6 changed files with 8 additions and 8 deletions
@@ -106,7 +106,7 @@ define( [ 'utils/utils' ], function( Utils ) {
_templateRow: function( options ) {
return '<tr class="upload-ftp-row">' +
'<td class="_has_collection" style="display: none;"><div class="icon"/></td>' +
'<td class="ftp-name">' + options.path + '</td>' +
'<td class="ftp-name">' + _.escape(options.path) + '</td>' +
'<td class="ftp-size">' + Utils.bytesToString( options.size ) + '</td>' +
'<td class="ftp-time">' + options.ctime + '</td>' +
'</tr>';
+1 -1
View File
@@ -1 +1 @@
{"version":3,"file":"upload-ftp.js","sources":["../../../src/mvc/upload/upload-ftp.js"],"names":["define","Utils","Backbone","View","extend","initialize","options","self","this","merge","class_add","class_remove","class_partial","collection","onchange","onadd","onremove","setElement","_template","rows","get","url","Galaxy","root","success","ftp_files","_fill","error","length","$","html","_templateTable","size","index","push","_add","bytesToString","show","$select_all","addClass","on","add","hasClass","ftp_file","model_index","_find","trigger","_refresh","_templateInfo","hide","$it","_templateRow","$icon","find","append","removeClass","filtered","where","file_mode","enabled","item","findWhere","file_path","path","ctime","ftp_upload_site"],"mappings":"AACAA,QAAU,eAAiB,SAAUC,GACjC,MAAOC,UAASC,KAAKC,QACjBC,WAAY,SAAUC,GAClB,GAAIC,GAAOC,IACXA,MAAKF,QAAUL,EAAMQ,MAAOH,GACxBI,UAAkB,oCAClBC,aAAkB,0CAClBC,cAAkB,0CAClBC,WAAkB,KAClBC,SAAkB,aAClBC,MAAkB,aAClBC,SAAkB,eAEtBR,KAAKK,WAAaL,KAAKF,QAAQO,WAC/BL,KAAKS,WAAYT,KAAKU,aACtBV,KAAKW,QACLlB,EAAMmB,KACFC,IAAUC,OAAOC,KAAO,mBACxBC,QAAU,SAAUC,GAAclB,EAAKmB,MAAOD,IAC9CE,MAAU,WAAapB,EAAKmB,YAKpCA,MAAO,SAAUD,GACb,GAAKA,GA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AUhC,EAAKD,QAAQI,aAJ7BH,EAAKD,QAAQS,MAAO4B,GACpBS,EAAMb,SAAUhC,EAAKD,QAAQK,eAKjCJ,EAAKwC,cAGTG,EAAIV,GAAG,QAAS,WAAajC,EAAKD,QAAQQ,SAAU6B,KAEjDO,GAIXH,SAAU,WACN,GAAIS,GAAWhD,KAAKK,WAAW4C,OAASC,UAAW,MAAOC,SAAS,GACnEnD,MAAK8B,YAAYiB,cAEb/C,KAAK8B,YAAYC,SADG,GAAnBiB,EAAS5B,OACiBpB,KAAKF,QAAQI,UAEb8C,EAAS5B,QAAUpB,KAAKW,KAAKS,OAASpB,KAAKF,QAAQK,aAAeH,KAAKF,QAAQM,gBAKlHiC,MAAO,SAAUF,GACb,GAAIiB,GAAOpD,KAAKK,WAAWgD,WACvBC,UAAcnB,EAASoB,KACvBL,UAAc,MACdC,SAAc,GAElB,OAAOC,IAAQA,EAAKxC,IAAI,OAI5B+B,aAAc,SAAU7C,GACpB,MAAQ,8HAE8BA,EAAQyD,KAAO,6BACf9D,EAAMmC,cAAe9B,EAAQ0B,MAAS,6BACtC1B,EAAQ0D,MAAQ,cAK1DjC,eAAgB,WACZ,MAAQ,mfAqBZiB,cAAe,WACX,MAAQ,uGAMZ9B,UAAW,WACP,MAAQ,6NAEuJV,KAAKF,QAAQ2D,gBAAkB"}
{"version":3,"file":"upload-ftp.js","sources":["../../../src/mvc/upload/upload-ftp.js"],"names":["define","Utils","Backbone","View","extend","initialize","options","self","this","merge","class_add","class_remove","class_partial","collection","onchange","onadd","onremove","setElement","_template","rows","get","url","Galaxy","root","success","ftp_files","_fill","error","length","$","html","_templateTable","size","index","push","_add","bytesToString","show","$select_all","addClass","on","add","hasClass","ftp_file","model_index","_find","trigger","_refresh","_templateInfo","hide","$it","_templateRow","$icon","find","append","removeClass","filtered","where","file_mode","enabled","item","findWhere","file_path","path","_","escape","ctime","ftp_upload_site"],"mappings":"AACAA,QAAU,eAAiB,SAAUC,GACjC,MAAOC,UAASC,KAA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uJV,KAAKF,QAAQ6D,gBAAkB"}
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,2 +1,2 @@
define(["utils/utils"],function(a){return Backbone.View.extend({initialize:function(b){var c=this;this.options=a.merge(b,{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o",collection:null,onchange:function(){},onadd:function(){},onremove:function(){}}),this.collection=this.options.collection,this.setElement(this._template()),this.rows=[],a.get({url:Galaxy.root+"api/remote_files",success:function(a){c._fill(a)},error:function(){c._fill()}})},_fill:function(b){if(b&&b.length>0){this.$(".upload-ftp-content").html($(this._templateTable()));var c=0;for(index in b)this.rows.push(this._add(b[index])),c+=b[index].size;if(this.$(".upload-ftp-number").html(b.length+" files"),this.$(".upload-ftp-disk").html(a.bytesToString(c,!0)),this.collection){var d=this;this.$("._has_collection").show(),this.$select_all=this.$(".upload-selectall").addClass(this.options.class_add),this.$select_all.on("click",function(){var a=d.$select_all.hasClass(d.options.class_add);for(index in b){var c=b[index],e=d._find(c);(!e&&a||e&&!a)&&d.rows[index].trigger("click")}}),this._refresh()}}else this.$(".upload-ftp-content").html($(this._templateInfo()));this.$(".upload-ftp-wait").hide()},_add:function(a){var b=this,c=$(this._templateRow(a)),d=c.find(".icon");return this.$("tbody").append(c),this.collection?(d.addClass(this._find(a)?this.options.class_remove:this.options.class_add),c.on("click",function(){var c=b._find(a);d.removeClass(),c?(b.options.onremove(c),d.addClass(b.options.class_add)):(b.options.onadd(a),d.addClass(b.options.class_remove)),b._refresh()})):c.on("click",function(){b.options.onchange(a)}),c},_refresh:function(){var a=this.collection.where({file_mode:"ftp",enabled:!0});this.$select_all.removeClass(),this.$select_all.addClass(0==a.length?this.options.class_add:a.length==this.rows.length?this.options.class_remove:this.options.class_partial)},_find:function(a){var b=this.collection.findWhere({file_path:a.path,file_mode:"ftp",enabled:!0});return b&&b.get("id")},_templateRow:function(b){return'<tr class="upload-ftp-row"><td class="_has_collection" style="display: none;"><div class="icon"/></td><td class="ftp-name">'+b.path+'</td><td class="ftp-size">'+a.bytesToString(b.size)+'</td><td class="ftp-time">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span class="upload-ftp-number"/>&nbsp;&nbsp;<span class="upload-icon fa fa-hdd-o"/><span class="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th class="_has_collection" style="display: none;"><div class="upload-selectall"></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody/></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div class="upload-ftp-content"/><div>'}})});
define(["utils/utils"],function(a){return Backbone.View.extend({initialize:function(b){var c=this;this.options=a.merge(b,{class_add:"upload-icon-button fa fa-square-o",class_remove:"upload-icon-button fa fa-check-square-o",class_partial:"upload-icon-button fa fa-minus-square-o",collection:null,onchange:function(){},onadd:function(){},onremove:function(){}}),this.collection=this.options.collection,this.setElement(this._template()),this.rows=[],a.get({url:Galaxy.root+"api/remote_files",success:function(a){c._fill(a)},error:function(){c._fill()}})},_fill:function(b){if(b&&b.length>0){this.$(".upload-ftp-content").html($(this._templateTable()));var c=0;for(index in b)this.rows.push(this._add(b[index])),c+=b[index].size;if(this.$(".upload-ftp-number").html(b.length+" files"),this.$(".upload-ftp-disk").html(a.bytesToString(c,!0)),this.collection){var d=this;this.$("._has_collection").show(),this.$select_all=this.$(".upload-selectall").addClass(this.options.class_add),this.$select_all.on("click",function(){var a=d.$select_all.hasClass(d.options.class_add);for(index in b){var c=b[index],e=d._find(c);(!e&&a||e&&!a)&&d.rows[index].trigger("click")}}),this._refresh()}}else this.$(".upload-ftp-content").html($(this._templateInfo()));this.$(".upload-ftp-wait").hide()},_add:function(a){var b=this,c=$(this._templateRow(a)),d=c.find(".icon");return this.$("tbody").append(c),this.collection?(d.addClass(this._find(a)?this.options.class_remove:this.options.class_add),c.on("click",function(){var c=b._find(a);d.removeClass(),c?(b.options.onremove(c),d.addClass(b.options.class_add)):(b.options.onadd(a),d.addClass(b.options.class_remove)),b._refresh()})):c.on("click",function(){b.options.onchange(a)}),c},_refresh:function(){var a=this.collection.where({file_mode:"ftp",enabled:!0});this.$select_all.removeClass(),this.$select_all.addClass(0==a.length?this.options.class_add:a.length==this.rows.length?this.options.class_remove:this.options.class_partial)},_find:function(a){var b=this.collection.findWhere({file_path:a.path,file_mode:"ftp",enabled:!0});return b&&b.get("id")},_templateRow:function(b){return'<tr class="upload-ftp-row"><td class="_has_collection" style="display: none;"><div class="icon"/></td><td class="ftp-name">'+_.escape(b.path)+'</td><td class="ftp-size">'+a.bytesToString(b.size)+'</td><td class="ftp-time">'+b.ctime+"</td></tr>"},_templateTable:function(){return'<span style="whitespace: nowrap; float: left;">Available files: </span><span style="whitespace: nowrap; float: right;"><span class="upload-icon fa fa-file-text-o"/><span class="upload-ftp-number"/>&nbsp;&nbsp;<span class="upload-icon fa fa-hdd-o"/><span class="upload-ftp-disk"/></span><table class="grid" style="float: left;"><thead><tr><th class="_has_collection" style="display: none;"><div class="upload-selectall"></th><th>Name</th><th>Size</th><th>Created</th></tr></thead><tbody/></table>'},_templateInfo:function(){return'<div class="upload-ftp-warning warningmessage">Your FTP directory does not contain any files.</div>'},_template:function(){return'<div class="upload-ftp"><div class="upload-ftp-wait fa fa-spinner fa-spin"/><div class="upload-ftp-help">This Galaxy server allows you to upload files via FTP. To upload some files, log in to the FTP server at <strong>'+this.options.ftp_upload_site+'</strong> using your Galaxy credentials (email address and password).</div><div class="upload-ftp-content"/><div>'}})});
//# sourceMappingURL=../../../maps/mvc/upload/upload-ftp.js.map