Commit f8141446 authored by Jérôme Chauveau's avatar Jérôme Chauveau
Browse files

manage static file sub paths

parent ae683529
Loading
Loading
Loading
Loading
+4 −4
Changes for src/main/core/routes.xqm: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -251,15 +251,15 @@ declare %private function routes:list(){

(:~
 : Returns a static file.
 : @param  $file  file or unknown path
 : @param  $filepath  file or unknown path
 : @return rest binary data
 :)
declare %rest:path("/{$bundle}/static/{$filename}")
declare %rest:path("/{$bundle}/static/{$filepath=.+}")
function routes:file(
  $bundle as xs:string, $filename as xs:string
  $bundle as xs:string, $filepath as xs:string
) as item()+ {
    try {
    let $path := utils:get-bundles-path() || $bundle || '/static/' || $filename
    let $path := utils:get-bundles-path() || $bundle || '/static/' || $filepath
    return (
      web:response-header(
        { 'media-type': web:content-type($path) },