Back

Storage.createFile makes the local file to have double extensions

  • 0
  • Self Hosted
  • Storage
alon1874
3 Jan, 2024, 16:54

I'm creating a json file and uploading it to the storage bucket, for some reason on the fs I see the file name as "<filename>.json.json, although its id is <filename>.json. Same behavior happens even when I upload a file from the console and give it the <filename>.json id. Is there a way to control that?

TL;DR
Users are experiencing an issue where the `Storage.createFile` function is causing the local file to have double extensions. This occurs when uploading files to the storage bucket. The issue seems to persist even when uploading files from the console. The code used to create and upload the file is provided. The cause of the issue is unclear. Solution: There is no explicit solution mentioned in the support thread. Further investigation or debugging of the code may be necessary to resolve the issue.
Kenny
3 Jan, 2024, 17:04

What does your code look like

Drake
3 Jan, 2024, 18:49

ID does not affect the name

alon1874
3 Jan, 2024, 18:49

It also happens from the console itself. I upload a file, set its id and see it with a wrong name on the fs

alon1874
3 Jan, 2024, 18:50

ill share the code

Drake
3 Jan, 2024, 18:50

with a wrong name on the fs What do you mean?

alon1874
3 Jan, 2024, 18:51
TypeScript
    let jsonFilename = `${fileName}.json`
    const jsonBlob = new Blob([contentString], { type: 'application/json' });
    var jsonFile = new File([jsonBlob], jsonFilename);
    console.log("this json file", jsonFilename);
    await api.provider().storage.createFile(
      Server.storageBucket,
      jsonFilename,
      jsonFile
  ).catch(err => {
    console.log("err json filename", err)
  });```
alon1874
3 Jan, 2024, 18:53
Drake
3 Jan, 2024, 18:53

and this is with the web or node sdk?

alon1874
3 Jan, 2024, 18:53

^ this is when I uploaded from the console

alon1874
3 Jan, 2024, 18:53

web sdk

alon1874
3 Jan, 2024, 18:54

I'll mention that the file security and the encryption are set to off

Drake
3 Jan, 2024, 18:59

cloud is working fine:

Drake
3 Jan, 2024, 19:00

this was uploaded via the console

alon1874
3 Jan, 2024, 19:00

can you tell what's on the fs itself?

Drake
3 Jan, 2024, 19:01
alon1874
3 Jan, 2024, 19:19

I think that when tryint to upload del.json.json is the same as del.json.json. may you try to upload del1.json ?

alon1874
3 Jan, 2024, 21:05

@Steven ?

Drake
3 Jan, 2024, 21:20

what?

Are you uploading the same file again without deleting it?

alon1874
4 Jan, 2024, 01:01

In your cloud test you've uploaded "del.json.json" which is being saved on the fs with the same name as if you were saving "del.json". As example , try to upload "test.json"

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more