firebase / firebase/firebase-admin-node

imageUrl with special characters, are not allowed in firebase messaging. But there exists a lots of image urls with different special characters.

Aperta
#1,213 4 commenti 1 reazione 0 assegnatari Vedi su GitHub
api: messaging
Lingua principale
TypeScript
Stelle
1.7k
Fork
419
Merge medio
3g 10h
PR unite (30g)
16

Descrizione

Environment:
* Operating System Version: Ubuntu 20.04.2 LTS
* Firebase SDK version: 9.4.1
* Firebase Product: messaging (fcm)
* Node.js version: v12.21.0
* NPM Version: 6.14.11

Steps to reproduce:

* Following code is in typescript.

```
import * as admin from 'firebase-admin';

let message: admin.messaging.MulticastMessage = {
tokens: [""],
notification: {
title: "This is a test notification on fcm",
body: "This notification is to check if image with specials chars can be sent in fcm notification",
imageUrl: "https://s.yimg.com/uu/api/res/1.2/8e4p0MNjKRtV25O3t_qSMw--~B/aD00MjU7dz04MDA7YXBwaWQ9eXRhY2h5b24-/https://media.zenfs.com/en/nextshark_articles_509/287cce64e3a1cd49446e8751b89262ef"
}
}
admin.messaging().sendMulticast(message)
.then((response: admin.messaging.BatchResponse) => {
console.log("Message has been sent...");
})
.catch((error: any) => {
console.log(error);
// This notification throws here, and flow comes in this section
// Error is "notification.imageUrl must be a valid URL string"
});
```

As we see, the above example, the imageUrl has multiple special characters, still it is an URL which can surely load an image.
But, firebase admin doesn't accept this.

Hope to see some upgrades in the pattern checking rules of imageUrl.

Thanks.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia riproducendo l’esempio TypeScript segnalato tramite admin.messaging().sendMulticast e traccia la convalida di notification.imageUrl. Confronta le regole per gli URL accettati con l’URL segnalato; il lavoro è completo quando gli URL di immagini validi contenenti questi caratteri speciali vengono accettati, mentre gli URL malformati continuano a essere rifiutati, con una copertura per entrambi i casi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
node.js, typescript
Ambito
api
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.