Skip to content
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

无法上传附件 #22

Open
1889737514 opened this issue Jun 20, 2023 · 3 comments
Open

无法上传附件 #22

1889737514 opened this issue Jun 20, 2023 · 3 comments

Comments

@1889737514
Copy link

Bug 描述

使用附件框上传附件时虽显示上传成功,但是实际插入的链接却是/meol/[object Object]" href="/meol/[object Object]

你预期的样子是?

附件链接应为/meol/common/ckeditor/openfile.jsp?id=xxx

脚本的版本

右上角下拉菜单/检查更新

2.4.0

浏览器及版本号

一般位于设置/关于

Firefox 114.0.1/ViolentMonkey 2.14.0
Firefox For Android 114.1.1/TamperMonkey 4.18.1
Chrome 114.0.5735.134/TamperMonkey 4.19.0

最小成本的复现步骤

请告诉我们,如何最快的复现该 bug

  • 步骤一:随意打开一个作业提交面板
  • 步骤二:上传附件
  • 步骤三:查看插入的链接,发现有误
@ZiuChen
Copy link
Owner

ZiuChen commented Jun 24, 2023

感谢反馈。
检查了一下,是这部分出了问题:

const handleUploadSuccess = (response, file, fileList) => {
const innerNode = {
type: "link",
url: `/meol/${response}" href="/meol/${response}`,
children: [{ text: file.name }],
};

之前的response为资源链接纯文本,可能是因为最近课程平台进行过更新,将response变成了对象结构
导致stringify时直接成为了[object Object]

image

可以做如下修改以适应课程平台更新:

...
const handleUploadSuccess = (response, file, fileList) => {
  const innerNode = {
    type: "link",
    url: `/meol/${response?.url || ''}" href="/meol/${response}`,
    children: [{ text: file.name }],
  };
...

我自己也重新打了一个版本,因为我已毕业,所以无法测试修改后的效果
你可以试用一下再给我反馈,就不发版了:index.prod.user.zip

@dasoumao
Copy link

dasoumao commented Jul 1, 2023

url的/meol/${response}部分只需要${response},平台会补上/meol/

@1889737514
Copy link
Author

url的/meol/${response}部分只需要${response},平台会补上/meol/

对,上面这个版本生成的链接会有重复的/meol部分,去掉后就是正常链接

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

No branches or pull requests

3 participants