Fix issue with serving assets inside folders
This commit is contained in:
parent
61afce46ed
commit
396fc701c7
3 changed files with 7 additions and 4 deletions
|
@ -249,7 +249,8 @@ class PreviewFrame extends React.Component {
|
||||||
let jsFileStrings = content.match(STRING_REGEX);
|
let jsFileStrings = content.match(STRING_REGEX);
|
||||||
jsFileStrings = jsFileStrings || [];
|
jsFileStrings = jsFileStrings || [];
|
||||||
jsFileStrings.forEach((jsFileString) => {
|
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 filePath = jsFileString.substr(1, jsFileString.length - 2);
|
||||||
const resolvedFile = resolvePathToFile(filePath, files);
|
const resolvedFile = resolvePathToFile(filePath, files);
|
||||||
if (resolvedFile) {
|
if (resolvedFile) {
|
||||||
|
@ -262,7 +263,7 @@ class PreviewFrame extends React.Component {
|
||||||
newContent = newContent.replace(filePath, blobURL);
|
newContent = newContent.replace(filePath, blobURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
});
|
});
|
||||||
newContent = loopProtect(newContent);
|
newContent = loopProtect(newContent);
|
||||||
return newContent;
|
return newContent;
|
||||||
|
|
|
@ -132,7 +132,9 @@ export function getProjectAsset(req, res) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var assetURL = null;
|
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) => {
|
project.files.forEach((file) => {
|
||||||
if(file.name === seekFilename) {
|
if(file.name === seekFilename) {
|
||||||
assetURL = file.url;
|
assetURL = file.url;
|
||||||
|
|
|
@ -25,7 +25,7 @@ router.route('/:username/sketches/:project_id').get((req, res) => {
|
||||||
res.send(renderIndex());
|
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);
|
getProjectAsset(req,res);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue