-
Notifications
You must be signed in to change notification settings - Fork 50
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
TypeError occurred using a Japanese file name #139
Comments
@tominaga-h thanks for surfacing and also having the foresight to give me the text for the name 😅. I was about to kick off a release but let me see if I can repro/fix quickly and smuggle this in if so. I'll keep you posted! |
Hey @tominaga-h unfortunately I wasn't able to reproduce on a quick smoke test using our |
@cjpillsbury |
No need for waiting on our release side. If you are still encountering an issue and can get us a reproducible setup and it's a quick fix, we can always just push out another release. |
@cjpillsbury
In my program, when a user uploads a file with a Japanese filename, the program encodes the filename using The following source code what I updated: const file = $("#form_file")[0].files[0];
const blob = file.slice(0, file.size, file.type);
const encoded_file = new File([blob], encodeURIComponent(file.name), {type: file.type});
console.log(file);
await new Promise((resolve, reject) => {
const upload = UpChunk.createUpload({
endpoint: url,
file: encoded_file,
chunkSize: 4096,
});
upload.on("error", (err) => {
console.error("[ChunkUpload] Error", err.detail);
});
upload.on("progress", ({ detail: progress }) => {
console.log(`Progress: ${progress}%`);
});
upload.on("chunkSuccess", ({ detail }) => {
const { response } = detail;
const { result, order_asset_id } = JSON.parse(
response.body
);
window.orderAssetId = order_asset_id;
if (result === 201) {
console.log("Chunk upload succeded!");
} else {
console.log(`Chunk upload failed. status: ${result}`);
upload.abort();
reject();
}
});
upload.on("success", () => {
console.log("[ChunkUpload] Success!");
});
}).catch((error) => {
console.log("エラー");
console.error(error);
}); You can download the file from the following link: |
@cjpillsbury |
@tominaga-h You are trying to upload an image |
@mayur-padshala |
@mayur-padshala since upchunk is just a chunked transfer file upload library, it should work with any binary files. @tominaga-h as mentioned previously, since I was able to successfully upload a file with a japanese file name using upchunk with our example source/html, I don't know that I can promise any forward progress here unless you can provide me with a full working code example that reproduces the issue. This can be a codesandbox/stackblitz or the like, a github repo link with documentation for any steps to build/run where relevant, or the like. Happy to investigate further if you can get us this. |
The following TypeError occurred When I uploaded a file with a Japanese file name. The upchunk.js didn't send a request when this error occurred. I tried to use a new File object with an encoded Japanese filename using
encodeURIComponent
, but it also failed with the same TypeError.My javascript source code is here:
I have attached the following jpg file I used. the file name is "日本語ファイル.jpg"
The text was updated successfully, but these errors were encountered: