Selaa lähdekoodia

make values with white spaces possible

a user might enter values with white spaces, and that should be possible
and valid

Signed-off-by: Artur Neumann <info@individual-it.net>
Artur Neumann 7 vuotta sitten
vanhempi
commit
9790fe7f5d
2 muutettua tiedostoa jossa 8 lisäystä ja 1 poistoa
  1. 1 1
      core/js/js.js
  2. 7 0
      core/js/tests/specs/coreSpec.js

+ 1 - 1
core/js/js.js

@@ -1682,7 +1682,7 @@ OC.Util = {
 			return null;
 		}
 
-		var s = string.toLowerCase();
+		var s = string.toLowerCase().trim();
 		var bytes = null;
 
 		var bytesArray = {

+ 7 - 0
core/js/tests/specs/coreSpec.js

@@ -619,6 +619,13 @@ describe('Core base tests', function() {
 					['B', null],
 					['40/0', null],
 					['40,30 kb', null],
+					[' 122.1 MB ', 128031130],
+					['122.1 MB ', 128031130],
+					[' 122.1 MB ', 128031130],
+					['	122.1 MB ', 128031130],
+					['122.1    MB ', 128031130],
+					[' 125', 125],
+					[' 125 ', 125],
 				];
 				for (var i = 0; i < data.length; i++) {
 					expect(OC.Util.computerFileSize(data[i][0])).toEqual(data[i][1]);