overleaf/services/web/public/coffee/ide/directives/validFile.coffee
2018-02-07 16:14:56 +00:00

12 lines
287 B
CoffeeScript

define [
"base"
"ide/directives/SafePath"
], (App, SafePath) ->
App.directive "validFile", () ->
return {
require: 'ngModel'
link: (scope, element, attrs, ngModelCtrl) ->
ngModelCtrl.$validators.validFile = (filename) ->
return SafePath.isCleanFilename filename
}