Skip to content

Commit

Permalink
remove extraneous header and tail from filenames in directory listings
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason J. Gullickson committed Jan 3, 2015
1 parent e96cf3c commit 689aa1c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions jsfs2.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,15 @@ http.createServer(function(req, res){
for(var file in stored_files){
if(stored_files.hasOwnProperty(file)){
if(!stored_files[file].private && (file.indexOf(target_url) > -1)){

// remove leading path from filename
file = file.slice(target_url.length);

// remove trailing path from subdirectories
if(file.indexOf("/") > -1){
file = file.slice(0,(file.indexOf("/") + 1));
}

public_directory.push(file);
}
}
Expand Down

0 comments on commit 689aa1c

Please sign in to comment.