overleaf/services/web/public/coffee/ide/directives/validFile.coffee
2018-02-07 15:50:29 +00:00

14 lines
369 B
CoffeeScript

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