-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File already in Hatrac, update with new filename #1009
Conversation
… of making chaise act on the response
@RFSH I've updated the code to make the change you suggested. It makes sense to update the One note I should have mentioned before is about the logging. I updated the main body above to comment about the added log action and if we should go with what I proposed or if there is a better phrase to use. |
js/hatrac.js
Outdated
|
||
var data = "filename*=UTF-8''" + self.file.name.replace(FILENAME_REGEXP, '_'); | ||
|
||
if (!contextHeaderParams || !_isObject(contextHeaderParams)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If contextHeaderParams
wasn't passed to this function, line 417-423 would create it. So this if
statement is pointless and this code will always use the same action for both requests. Instead you should assume contextHeaderParams
is available here and do
contextHeaderParams.action = 'upload/metadata/update';
So
...
var data = "filename*=UTF-8''" + self.file.name.replace(FILENAME_REGEXP, '_');
contextHeaderParams.action = 'upload/metadata/update';
var config = {
headers: _generateContextHeader(contextHeaderParams)
};
config.headers['content-type'] = 'text/plain';
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I manually tested uploading on chaise and ran the unit test cases. Everything works as epcted.
The changes overall look good and I just asked for a small change related to how the logging is done.
This PR intends to modify the
fileExists
check inhatrac.js
for updating thecontent-disposition
for a file that already exists (same md5 and content), except the new file has a different name.One note about this PR is that a new logging action is being added,
"upload/metadata/update"
. This follows a similar pattern with the existingcreateUploadJob
that sets"upload/create"
as the action. I figured"upload/update"
wasn't specific enough (since we are only updating metadata, not the whole file) and in this case we are "updating" existing content rather than creating something new.For documentation, where should this "action" be added? I didn't see our other action for upload in the Action List spreadsheet.