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

[Bug]: 安装了remove-exif后无法上传图片 #18

Closed
3 tasks done
BIMiracle opened this issue Mar 9, 2023 · 3 comments
Closed
3 tasks done

[Bug]: 安装了remove-exif后无法上传图片 #18

BIMiracle opened this issue Mar 9, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@BIMiracle
Copy link

前置阅读 | Pre-reading

PicList的版本 | PicList Version

1.4.1

系统信息 | System Information

Windows

问题重现 | Bug reproduce

安装插件前还能上传,安装以后就一致卡在 Starting to remove EXIF data

相关日志 | Logs

2023-03-09 18:03:02 [PicList INFO] Compress or convert image
2023-03-09 18:03:03 [PicList INFO] Before transform
2023-03-09 18:03:03 [PicList INFO] Transforming... Current transformer is [path]
2023-03-09 18:03:03 [PicList INFO] Before upload
2023-03-09 18:03:03 [PicList INFO] beforeUploadPlugins: renameFn running
2023-03-09 18:03:03 [PicList INFO] Uploading... Current uploader is [github]
2023-03-09 18:03:05 [PicList SUCCESS]
https://xxxx.webp
2023-03-09 18:03:06 [PicList INFO] detect second instance
2023-03-09 18:03:31 [PicList SUCCESS] 插件安装成功
2023-03-09 18:03:44 [PicList INFO] Compress or convert image
2023-03-09 18:03:44 [PicList INFO] Before transform
2023-03-09 18:03:44 [PicList INFO] Transforming... Current transformer is [path]
2023-03-09 18:03:44 [PicList INFO] Before upload
2023-03-09 18:03:44 [PicList INFO] beforeUploadPlugins: renameFn running
2023-03-09 18:03:44 [PicList INFO] beforeUploadPlugins: remove-exif running
2023-03-09 18:03:44 [PicList INFO] **** Starting to remove EXIF data ****

@BIMiracle BIMiracle added the bug Something isn't working label Mar 9, 2023
@Kuingsmile
Copy link
Owner

好的 我排查下看看

@Kuingsmile
Copy link
Owner

Kuingsmile commented Mar 10, 2023

picgo-plugin-remove-exif包使用了sharp来进行操作,核心代码仅一句:

outputi.buffer = await sharp(b).toBuffer()

测试过程

经过测试,该插件在PicList-Core中可以正常使用,说明问题来自electron环境,在PicList中,具体报错为:

2023-03-09 20:00:48 [PicList ERROR]
------Error Stack Begin------
Error: External buffers are not allowed
-------Error Stack End-------

通过查询sharp和electron的官方项目相关信息,该问题产生的原因来自electron 21.0之后的一次安全性更新,具体可以参考:

简单的来说,electron 21.0中不再允许来自external memory的arraybuffer对象,导致了报错。

The main downside of enabling sandboxed pointers is that ArrayBuffers which point to external ("off-heap") memory are no longer allowed. This means that native modules which rely on this functionality in V8 will need to be refactored to continue working in Electron 20 and later.

由于PicList更新了electron版本至22.0,而PicGo使用的是16.0,因此该插件在PicList中无法正常工作,但PicGo中可以。

另外,sharp 0.31.3版本也修复了这个问题,这也是PicList默认内置的版本,但该插件使用的版本是0.30.7,所以有问题。

解决方案

由于这个插件的功能实现非常简单,而且PicList本身就依赖于sharp,因此下个版本中我会将移除EXIF信息这个功能内置在PicList的图片处理选项中,后续请更新版本,并且不要在PicList内使用该插件,或者让插件作者更新下sharp依赖版本。
@BIMiracle

@BIMiracle
Copy link
Author

好的,非常感谢讲的十分清楚,学到了

Kuingsmile added a commit that referenced this issue Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants