-
Notifications
You must be signed in to change notification settings - Fork 34
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
The program will fail when copying images larger than 32MB. #1878
Comments
@sunxiang0918. 👍🏻 Thank you very much for providing such a detailed bug description. This is extremely helpful for fixing the bug. |
@sunxiang0918. I have merged the fix into the main branch. Thank you very much for your help. ![]() Lines 100 to 114 in 5194fbc
|
What a high efficiency! I know this function of github, but I have the development environment of the project. When a problem occurs, I am more accustomed to using IDE break points to confirm the cause of the problem, so I took a screenshot~ |
另外我还发现了一个生成缩略图相关的BUG. ![]() 我大概找了一下原因,网上说的可能和CPU与内存相关: 我自己稍微试了一下. `
` |
In addition, I also found a BUG related to generating thumbnails. ![]() I roughly looked for the reason, and what was said on the Internet may be related to CPU and memory: I tried it a little bit myself. `
` |
I have created a new issue. Let's discuss how to solve this bug in the new issue. |
How frequently does the bug occur?
Always
Description
当复制比较大的图片的时候,程序后台会报错,导致记录复制项失败.
分析源码:
当复制文件的时候,会进入到 FilesTypePlugin 这个文件类型的插件中去尝试进行文件的拷贝. 但是,由于文件大小超过了 maxBackupFileSize设置的大小(默认32mb). 会导致 useRefCopyFiles变量为true (104行).

在后续拷贝文件的时候,会跳过该文件,只记录该文件的相对路径(在这里实际就是文件名)(110-113行).
这些操作在对于非图片的文件上是没有问题的.
但是当复制的文件是图片的时候, 由于需要更改PasteItem的类型, 所以会进入到 FilesToImagesPlugin中.

在这个类中,pasteItems里面记录的实际上 仅仅是一个文件名. 那么 在从files文件夹移动到images文件夹的逻辑中的时候.
srcPath其实是错误的,文件并不存在于.user/files/ 中.(28-30行) .
从而导致了 移动文件失败,抛出IllegalStateException 异常.(30-33行)
修复的话,可能对于这种并没有真正拷贝的图片文件, 要参考pasteAppearItem的basePath是否存在来决定是否真正的做移动的操作. 如果不移动,构造的ImagesPasteItem的 relativePathList与basePath 可能需要设置成和fileItem一样的值.
但是这样处理后, 在 FilesPreviewView 去生成缩略图的时候可能还是会出现找不到文件的情况.可能ImagesPasteItem的getFilePaths也需要改造.
Stacktrace & log output
No response
Can you reproduce the bug?
Always
Reproduction Steps
复制大于 maxBackupFileSize配置的 图片文件.
Version
5194fbc
OS
MacOS
The text was updated successfully, but these errors were encountered: