Skip to content

Commit

Permalink
Ignore empty lines (including one at end of file)
Browse files Browse the repository at this point in the history
Many text editors will add a newline at the end of the file without asking the user.
  • Loading branch information
zannalov committed Jul 19, 2012
1 parent 112ac98 commit cf353ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/DAV/plugins/auth/file.js
Expand Up @@ -43,6 +43,9 @@ function jsDAV_Auth_Backend_File(filename) {
return cbloadfile(err);

data.split("\n").forEach(function(line) {
if( '' == line ) /* ignore empty lines (including one at end of file) */
cbloadfile();

var parts = line.split(":");
if (line.length !== 3)
cbloadfile(new Exc.jsDAV_Exception("Malformed htdigest file. Every line should contain 2 colons"));
Expand Down

0 comments on commit cf353ae

Please sign in to comment.