overleaf/services/web/public/coffee/ide/directives/validFile.coffee

15 lines
369 B
CoffeeScript
Raw Normal View History

2018-02-05 11:56:52 -05:00
define [
"base"
"ide/directives/SafePath"
], (App, SafePath) ->
MAX_PATH = 1024 # Maximum path length, in characters. This is fairly arbitrary.
2018-02-05 11:56:52 -05:00
App.directive "validFile", () ->
return {
require: 'ngModel'
link: (scope, element, attrs, ngModelCtrl) ->
ngModelCtrl.$validators.validFile = (filename) ->
return SafePath.isCleanFilename filename
2018-02-05 11:56:52 -05:00
}