Преглед изворни кода

Bug fix: writing images were not being properly served.

Lee Morgan пре 5 година
родитељ
комит
b286e5274e
2 измењених фајлова са 2 додато и 2 уклоњено
  1. 1 1
      controllers/writing.js
  2. 1 1
      htmlCreator.js

+ 1 - 1
controllers/writing.js

@@ -23,7 +23,7 @@ module.exports = {
                 array.push({
                     title: meta[0],
                     route: dir.substring(dir.indexOf("/content/writing/") + 8),
-                    img: `${dir}/mainImage.jpg`
+                    img: `${dir.substring(dir.indexOf("/content/writing/") + 8)}/mainImage.jpg`
                 });
             }
             return array;

+ 1 - 1
htmlCreator.js

@@ -76,7 +76,7 @@ module.exports = (app)=>{
         let contents = fs.readdirSync(dir);
         for(let i = 0; i < contents.length; i++){
             if(contents[i].includes(".jpg") === true){
-                app.get(`${route}/${contents[i]}`, (req, res)=>{res.sendFile(`${__dirname}/content/route/${contents[i]}`)});
+                app.get(`${route}/${contents[i]}`, (req, res)=>{res.sendFile(`${__dirname}/content/${route}/${contents[i]}`)});
             }
         }