Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

268
Visualizações
Delete user profile in firebase storage delete everything

I have a simple app where user can upload a profile image. The function for upload works. I want a button to delete the user account and at the same time delete the user image from the firebase storage.

This is the simple function to delete the user picture:

  const deleteUserAccount = () => {
    firebase
      .storage()
      .ref(`users/${user.uid}/profile.jpg`)
      .delete()
      .then(() => {
        console.log('image deleted');
      })
      .catch((err) => {
        console.log(err);
      });

if I execute the function the whole "users" folder is deleted not only the one corresponding to the userId of the user. I just want to delete the corresponding {user.uid} folder.

Here my storage rules:

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{users}/{uid}/{profileImage} {
      allow read, write: if request.auth.uid == uid;
    }
  }
}

Thank you

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If there is nothing else but the profile.jpg in the folder, the behavior is actually as expected. Folders in Cloud Storage are auto-created and deleted as files are added and deleted. You can't have a folder without a file in (through the API).

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda