From 9a6415b7e26ebf32a237798b876e83e506f134eb Mon Sep 17 00:00:00 2001 From: George Hamilton Date: Tue, 26 Apr 2016 15:54:23 +0100 Subject: [PATCH] use SID in path for record upload: cobweb-eu/pcapi#43 --- src/www/js/upload.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/www/js/upload.js b/src/www/js/upload.js index 59b77a3..578741d 100644 --- a/src/www/js/upload.js +++ b/src/www/js/upload.js @@ -178,7 +178,11 @@ define(['records', 'map', 'utils', './ext/pcapi'], function( * @param {Object} options upload options */ var uploadAsset = function(file, fileName, options){ - var assetUrl = pcapi.buildUserUrl(userId, "records", record.name) + '/' + fileName; + var path = records.typeFromRecord(record) + "/" + record.name; + var assetUrl = pcapi.buildUserUrl( + userId, + "records", + path) + '/' + fileName; console.debug("Asset url is "+assetUrl); options.fileName = fileName; @@ -232,12 +236,10 @@ define(['records', 'map', 'utils', './ext/pcapi'], function( }, 1000); }; - //console.debug("Post: " + recordDir); - var save = pcapi.saveItem({ userId: userId, remoteDir: "records", - path: record.name, + path: records.typeFromRecord(record) + "/" + record.name, data: processedRecord });