Merge pull request #2477 from ssplatt/fix-file-path

Update file path trimming for fetch via http
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-11-02 03:09:15 -04:00
commit f57ed82f48
2 files changed
+16 -7

No files matched your search

+5 -3
View File
@@ -1,6 +1,8 @@
Data-Storage
Log-Files
My-Workspaces
**/Data-Storage
**/My-Data-Storage
**/Log-Files
**/My-Log-Files
**/My-Workspaces
debug.log
*.db
@@ -451,9 +451,16 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
function getFileViaHTTP(filePath, callback, callBackFunction) {
try {
/* The filePath received is the one that is needed to fetch data from with fs. To do it via http we need to remove the prefix that includes this: ./Data-Storage/ */
filePath = filePath.substring(15, filePath.length)
/*
The filePath received is the one that is needed to fetch data from with fs. To do it via http we need to remove the
prefix that includes this: ./Data-Storage/
*/
let pathArray = filePath.split('/')
let indexmax = pathArray.indexOf('My-Data-Storage') // TODO: get rid of hardcoded path name
for (var i = 0; i <= indexmax; i++) {
pathArray.shift()
}
filePath = pathArray.join('/')
let http = SA.nodeModules.http
let url = 'http://' + host +
@@ -506,4 +513,4 @@ exports.newFileStorage = function newFileStorage(processIndex, host, port) {
callBackFunction(TS.projects.foundations.globals.standardResponses.DEFAULT_RETRY_RESPONSE);
}
}
}
}