Răsfoiți Sursa

Don't allow backslashes in file names

James Allen 8 ani în urmă
părinte
comite
becb76d69b

+ 2 - 1
services/web/app/coffee/Features/Project/SafePath.coffee

@@ -7,7 +7,8 @@
 load = () ->
 	BADCHAR_RX = ///
 		[
-			\/ # no slashes
+			\/ # no forward slashes
+			\\ # no back slashes
 			\* # no asterisk
 			\u0000-\u001F # no control characters (0-31)
 			\u007F        # no delete

+ 2 - 1
services/web/public/coffee/ide/directives/SafePath.coffee

@@ -7,7 +7,8 @@
 load = () ->
 	BADCHAR_RX = ///
 		[
-			\/ # no slashes
+			\/ # no forward slashes
+			\\ # no back slashes
 			\* # no asterisk
 			\u0000-\u001F # no control characters (0-31)
 			\u007F        # no delete

+ 3 - 4
services/web/test/unit/coffee/Project/SafePathTests.coffee

@@ -79,10 +79,9 @@ describe 'SafePath', ->
 		# 	result = @SafePath.isCleanFilename 'hello.'
 		# 	result.should.equal false
 
-
-		# it 'should not accept \\', ->
-		# 	result = @SafePath.isCleanFilename 'foo\\bar'
-		# 	result.should.equal false
+		it 'should not accept \\', ->
+			result = @SafePath.isCleanFilename 'foo\\bar'
+			result.should.equal false
 
 	describe 'isAllowedLength', ->
 		it 'should accept a valid path "main.tex"', ->