{"action":"closed","issue":{"url":"https://api.github.com/repos/TTLabs/EvaporateJS/issues/210","repository_url":"https://api.github.com/repos/TTLabs/EvaporateJS","labels_url":"https://api.github.com/repos/TTLabs/EvaporateJS/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/TTLabs/EvaporateJS/issues/210/comments","events_url":"https://api.github.com/repos/TTLabs/EvaporateJS/issues/210/events","html_url":"https://github.com/TTLabs/EvaporateJS/issues/210","id":173117525,"number":210,"title":"It doesn't upload same file in different folder","user":{"login":"mario-areias","id":1810284,"avatar_url":"https://avatars.githubusercontent.com/u/1810284?v=3","gravatar_id":"","url":"https://api.github.com/users/mario-areias","html_url":"https://github.com/mario-areias","followers_url":"https://api.github.com/users/mario-areias/followers","following_url":"https://api.github.com/users/mario-areias/following{/other_user}","gists_url":"https://api.github.com/users/mario-areias/gists{/gist_id}","starred_url":"https://api.github.com/users/mario-areias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mario-areias/subscriptions","organizations_url":"https://api.github.com/users/mario-areias/orgs","repos_url":"https://api.github.com/users/mario-areias/repos","events_url":"https://api.github.com/users/mario-areias/events{/privacy}","received_events_url":"https://api.github.com/users/mario-areias/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":7,"created_at":"2016-08-25T05:32:12Z","updated_at":"2016-08-27T02:28:58Z","closed_at":"2016-08-27T02:28:58Z","body":"Ok, this one is definitely weird (and again not sure if is a real issue). When I am uploading files to S3, I am specifying the folder where I want the upload to happen. I do this by specifying the folder in the file name as done here (not quite sure if that's the right way to do it):\r\n\r\n```js\r\nvar uploadId = evaporate.add({\r\n                name: randomId + '/' + file.name,\r\n                file: file\r\n         }\r\n```\r\n\r\nThis works great for the first time. However, when I try to upload it again in a different folder and `allowS3ExistenceOptimization` is true, the `HEAD` request runs against the old folder name, so then the upload doesn't even start because Evaporate thinks the file is already uploaded. The problem is related to the code below.\r\n\r\n```js\r\nfunction uploadKey(fileUpload) {\r\n            // The key tries to give a signature to a file in the absence of its path.\r\n            // \"<filename>-<mimetype>-<modifieddate>-<filesize>\"\r\n            return [\r\n                fileUpload.file.name,\r\n                fileUpload.file.type,\r\n                dateISOString(fileUpload.file.lastModifiedDate),\r\n                fileUpload.file.size\r\n            ].join(\"-\");\r\n        }\r\n```\r\n\r\nAt this point the `fileUpload` object has the field `name` with the right value: `new-folder/file.jpg`. However, to create the upload key instead to use `fileUpload.name` Evaporate is using `fileUpload.file.name`. Which returns the file name only (`file.jpg`) and therefore when looking at the `localStorage` it returns the old upload id with the old folder name. So then the `HEAD` request is done and S3 returns that the file exists and the upload to the new folder doesn't even start.\r\n\r\nI wonder if the way I am setting the folder name is correct and if it is, if we shouldn't use the full path as a part of the key instead of the file name only. \r\n"}}
{"actor":{"display_login":"mario-areias"}}