diff --git a/server/routes/photos.js b/server/routes/photos.js index 5447b46..e04530a 100755 --- a/server/routes/photos.js +++ b/server/routes/photos.js @@ -55,11 +55,15 @@ router.get("/*", function(req, res/*, next*/) { } } - let query = "SELECT * FROM photos WHERE path LIKE :path " + index + " ORDER BY taken " + order + ",id " + order + " LIMIT " + (limit * 2 + 1); + let path = decodeURI(req.url).replace(/\?.*$/, ""), + query = "SELECT * FROM photos WHERE path LIKE :path " + index + " ORDER BY taken " + order + ",id " + order + " LIMIT " + (limit * 2 + 1); + + console.log("Fetching from: " + path); + return photoDB.sequelize.query(query, { replacements: { cursor: cursor, - path: decodeURI(req.url).replace(/\?.*$/, "") + "%" + path: path + "%" }, type: photoDB.Sequelize.QueryTypes.SELECT }).then(function(photos) {