Skip to content

Firebase Error: Firebase Storage: path param cannot contain '..' (storage/invalid-argument) #5180

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

Closed
pranab-witbybit opened this issue Jul 21, 2021 · 2 comments · Fixed by #5315
Assignees

Comments

@pranab-witbybit
Copy link

pranab-witbybit commented Jul 21, 2021

  • Operating System version: Windows 10 / Windows 11
  • Browser version: Chrome/91.0.4472.164
  • Firebase SDK version: 8.7.1
  • Firebase Product: storage

Problem Description

Files with double dot in name not downloading in web, with the error given in the header.

Steps to reproduce:

  • Upload a file with double dot in its name (such as test..txt). It will successfully upload.
  • Generate its downloadable url with its relative path
  • Download

Relevant Code:

   const storageRef = firebase.storage().ref(pathReference);
      storageRef
        .getDownloadURL()
        .then((url) => {
          window.open(url);
        })
        .catch((err) => { });
@looptheloop88
Copy link

Hi @pranab-witbybit, thanks for the report. I was able to replicate this issue when trying to get the download URL using path reference if the file type extension (.txt) is following a dot (.) character. I also confirmed that dot (.) character in between the file name is okay.

Not working

const pathReference = "images/test..txt";
const storageRef = firebase.storage().ref(pathReference);
storageRef.getDownloadURL()
  .then((url) => {
    console.log(url);
  })
  .catch((err) => { 
    console.log(err);
  });

Working

const pathReference = "images/te.st.txt";
const storageRef = firebase.storage().ref(pathReference);
storageRef.getDownloadURL()
  .then((url) => {
    console.log(url);
  })
  .catch((err) => { 
    console.log(err);
  });

On the other hand, it's also working fine if you get the download URL from the upload task snapshot.

storageRef.child(file.name).put(file, metadata).then(function (snapshot) {
  snapshot.ref.getDownloadURL().then(function (url) {
    console.log(url);
  });
}).catch(function (error) {
  console.log(error);
});

I am yet to find out if this is an intended behavior, since the SDK is able to catch the error. Let me check this out and update this if I have any information to share.

@nikhilag
Copy link

nikhilag commented Jul 23, 2021

@looptheloop88 Kindly note that Android works fine with path containing double dots. Hence my guess would be that this behaviour is not intended.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants