Comments (7)
Thanks for this @kayaademogullari. We're looking into this!
from aws-js-s3-explorer.
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.
from aws-js-s3-explorer.
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;
TypeError: Cannot convert string to ByteString because the character at index 23 has value 287 which is greater than 255.
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.
By the way, I've convert s3.makeUnauthenticatedRequest
to s3.makeRequest
, sorry for mistake. After that, I can manipulate all of this via a new CognitoIdentityCredentials
.
from aws-js-s3-explorer.
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);
});
from aws-js-s3-explorer.
Thank you very much.
from aws-js-s3-explorer.
Hi, I've solved the problem, changed CopySource parameter with encodeURI(file_name)
property, like this;
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...
from aws-js-s3-explorer.
Good news, thanks for the update.
from aws-js-s3-explorer.
Related Issues (20)
- cors policy in README doesn't work HOT 3
- README.md CORS config typo (v2-alpha) HOT 2
- Unable to open explorer with cloud front HOT 1
- Question: Hiding specific folders from view. HOT 1
- Feature Request - Add AD login HOT 2
- Network Failure
- Question: is there a way to specify service endpoint (endpoint URL)? HOT 5
- S3 local connection HOT 2
- AWS SSO/SAML Integration HOT 3
- Question: promptForBucketInput HOT 5
- Cors Issue
- Unable to list S3 object HOT 3
- django app based on your project HOT 2
- xss injection HOT 2
- Dependencies out of date
- Error accessing S3 bucket test-browse. Error: NetworkingError: Network Failure HOT 3
- Support storage backends other than S3 HOT 1
- Upload Speed HOT 3
- Method for CNAME creation HOT 1
- JSON CORS config in README HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-js-s3-explorer.