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.

未关闭
#1,213 4 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
api: messaging
主要语言
TypeScript
星标
1.7k
派生
419
平均合并
3 天 10 小时
30 天内合并 PR
16

描述

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.

贡献指南

打开贡献指南

调研方向

首先,通过 admin.messaging().sendMulticast 重现报告的 TypeScript 示例,并跟踪 notification.imageUrl 的验证过程。将接受的 URL 规则与报告的 URL 进行比较;完成的标准是,包含这些特殊字符的有效图片 URL 能够被接受,同时格式错误的 URL 仍会被拒绝,并覆盖这两种情况。

由索引模型根据 Issue 内容生成。

评估

技术栈
node.js, typescript
领域
api
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。