Fix issue with serving assets inside folders

This commit is contained in:
Zach Rispoli 2017-06-12 13:49:45 -04:00
parent 61afce46ed
commit 396fc701c7
3 changed files with 7 additions and 4 deletions

View File

@ -249,7 +249,8 @@ class PreviewFrame extends React.Component {
let jsFileStrings = content.match(STRING_REGEX);
jsFileStrings = jsFileStrings || [];
jsFileStrings.forEach((jsFileString) => {
if (jsFileString.match(MEDIA_FILE_REGEX)) {
console.log(this.props.setBlobUrl);
/* if (jsFileString.match(MEDIA_FILE_REGEX)) {
const filePath = jsFileString.substr(1, jsFileString.length - 2);
const resolvedFile = resolvePathToFile(filePath, files);
if (resolvedFile) {
@ -262,7 +263,7 @@ class PreviewFrame extends React.Component {
newContent = newContent.replace(filePath, blobURL);
}
}
}
}*/
});
newContent = loopProtect(newContent);
return newContent;

View File

@ -132,7 +132,9 @@ export function getProjectAsset(req, res) {
}
var assetURL = null;
var seekFilename = req.params.asset_path;
var seekPath = req.params[0]; // req.params.asset_path;
var seekPathSplit = seekPath.split('/');
var seekFilename = seekPathSplit[seekPathSplit.length-1];
project.files.forEach((file) => {
if(file.name === seekFilename) {
assetURL = file.url;

View File

@ -25,7 +25,7 @@ router.route('/:username/sketches/:project_id').get((req, res) => {
res.send(renderIndex());
});
router.route('/:username/sketches/:project_id/:asset_path').get((req, res) => {
router.route('/:username/sketches/:project_id/*').get((req, res) => {
getProjectAsset(req,res);
});