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.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.7k
- Fork
- 419
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 16
Mô tả
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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện ví dụ TypeScript đã được báo cáo thông qua admin.messaging().sendMulticast và theo dõi quá trình xác thực notification.imageUrl. So sánh các quy tắc URL được chấp nhận với URL đã được báo cáo; hoàn thành có nghĩa là các URL hình ảnh hợp lệ chứa những ký tự đặc biệt này được chấp nhận, trong khi các URL không đúng định dạng vẫn bị từ chối, với phạm vi kiểm thử bao phủ cả hai trường hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- node.js, typescript
- Lĩnh vực
- api
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100