Skip to content

Commit

Permalink
MK-577 Clean file path url with
Browse files Browse the repository at this point in the history
  • Loading branch information
ymarcon committed Nov 1, 2015
1 parent ebc0716 commit 06b6d75
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mica-webapp/src/main/webapp/app/file-system/file-system.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,29 @@ mica.fileSystem = angular.module('mica.fileSystem', [
'xeditable',
'ngFileUpload'
]);

// Workaround for bug #1388
// https://github.com/angular/angular.js/issues/1388
// replace %2F by /
mica.fileSystem.config(['$httpProvider', function($httpProvider) {
var ENCODED_SLASH = new RegExp("%2F", 'g');
$httpProvider.interceptors.push(function ($q) {
return {
'request': function (config) {
var url = config.url;
console.log('url=' + url);
var interceptULRS = [new RegExp('ws/draft/file.*'), new RegExp('ws/file.*')];
for (var i = 0; i < interceptULRS.length; i++) {
var regex = interceptULRS[i];
if (url.match(regex)) {
url = url.replace('/%2F','/').replace(ENCODED_SLASH, "/");
// end there is only one matching url
break;
}
}
config.url = url;
return config || $q.when(config);
}
};
});
}]);

0 comments on commit 06b6d75

Please sign in to comment.