-
Notifications
You must be signed in to change notification settings - Fork 271
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
copy/paste problem for non Latin characters named object #3
Comments
Thanks for this @kayaademogullari. We're looking into this! |
Hi @kayaademogullari, please you could document the steps leading to this error, include the non-Latin names, and indicate exactly which code is generating the TypeError. Thanks. |
I placed checkbox into renderObject function, function renderObject(data, type, full) {
/* if (isthisdocument(s3exp_config.Bucket, data)) {
console.log("is this document: " + data);
return fullpath2filename(data);
} else */if (isfolder(data)) {
console.log("is folder: " + data);
return '<div class="block" id="' + data + '"><div class="img dir"> </div><a data-s3="folder" data-prefix="' + data + '" href="' + object2hrefvirt(s3exp_config.Bucket, data) + '">' + prefix2folder(data) + '</a><p><input type="checkbox" class="messageCheckbox" name="' + data + '"id="' + data + '"value="' + data + '"></div>';
} else {
console.log("not folder/this document: " + data);
return '<div class="block" id="' + data + '"><div class="img ' + uzant(data) + '"> </div><a data-s3="object" href="' + object2hrefvirt(s3exp_config.Bucket, data) + '">' + fullpath2filename(data) + '</a><p><input type="checkbox" class="messageCheckbox" name="' + data + '"id="' + data + '"value="' + data + '"></div>';
}
} Here uzant(data) is a function that get extension file name to affect block and add file or folder icon for Objects. And below I've defined a function for choosing Object with checkbox. When an Object is checked, we get its name and if we press the rename button, calls bootbox, trigger jQuery.rename function and asks for new name. If object name is Latin, we can add a new ANY name without problem, else copyObject property doesnt work and console gives us error, for example;
getChecked = function () {
var result = $('input[type="checkbox"]:checked');
if (result.length > 0) {
var choosenObj = "";
result.each(function () {
choosenObj = $(this).val();
//filenameUnderFolder is a function that splits the path
var utf_8_file = filenameUnderFolder(choosenObj);
});
console.log(choosenObj);
jQuery.rename = function () {
bootbox.prompt({
title: "Enter a name for your file",
value: utf_8_file,
callback: function (result) {
if (result === null) {
//nothing happens
} else {
var s3 = new AWS.S3();
var params = {
Bucket: 'myBucket',
CopySource: 'myBucket' + '/folder_a/' + utf_8_file,
Key: 'folder_b/' + result,
StorageClass: 'STANDARD_IA'
};
s3.copyObject(params, function (err, data) {
if (err) console.log(err);
});
}
}
});
};
} else {
console.log('you choosed nothing.');
}
}; The getChecked function above included copy, paste, move, delete, getpresignedUrl functions in jQuery as well like rename, and works clearly. Of course, copy, paste and move functions have same non-Latin name problem too. |
Hi, I was able to copy an object to another object with a non-Latin filename as follows: var AWS = require("aws-sdk");
var s3 = new AWS.S3();
var params = {
Bucket: 'mybucket',
CopySource: 'myfolder/myfile.txt',
Key: 'myfolder/myfile\u0287.txt'
};
s3.copyObject(params, function (err, data) {
if (err) console.log(err);
}); |
Thank you very much. |
Hi, I've solved the problem, changed CopySource parameter with var s3 = new AWS.S3();
var params = {
Bucket: 'myBucket',
CopySource: 'myBucket' + '/folder_a/' + encodeURI(utf_8_file),
Key: 'folder_b/' + result,
StorageClass: 'STANDARD_IA'
};
s3.copyObject(params, function (err, data) {
if (err) console.log(err);
}); thats all... |
Good news, thanks for the update. |
Hi. I changed
s3.makeUnauthenticatedRequest
tos3.makeAuthenticatedRequest
and so, my clients may enters to their own non-website private buckets, upload / download file, add dir, rename, copy/cut/paste files easily via browser. But non-Latin character named objects cannot be able to copy and paste. This is the sample error in console;My code is quite simple;
I can change file names with Latin characters easily to Latin/non-Latin chars via copyObject property but non-Latin chars named object cannot be changed at all. What can be done?
The text was updated successfully, but these errors were encountered: