Fixed bug where certain files were returnign with the wrong slash on windows

This commit is contained in:
IrosTheBeggar 2017-07-05 19:50:28 -04:00
parent 9512e12124
commit f5d1ab9abb
2 changed files with 5 additions and 2 deletions

View File

@ -301,9 +301,11 @@ exports.setup = function (mstream, dbSettings){
// Format data for API
for(var i in rows ){
var path = String(rows[i]['cast(path as TEXT)']);
var relativePath = fe.relative(req.user.musicDir, path);
relativePath = relativePath.replace(/\\/g, '/')
songs.push({
"filepath": slash(fe.relative(req.user.musicDir, path)),
"filepath": relativePath,
"metadata": {
"artist": rows[i].artist,
"album": rows[i].album,

View File

@ -62,7 +62,8 @@ exports.setup = function(mstream, program){
}
}
var returnPath = slash( fe.relative(req.user.musicDir, path) );
var returnPath = fe.relative(req.user.musicDir, path) ;
returnPath = returnPath.replace(/\\/g, '/');
if(returnPath.slice(-1) !== '/'){
returnPath += '/';
}