Fix Failure when uploading clipboard images with PicGo (#3360) #3366
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Fix the situation that picgo uploading pictures from clipboard will keep spinning around and cannot upload successfully.
The reason for the error is that the clipboard image needs to be saved in a temporary file when uploading, but when calling string splicing, it tries to splice a number type into a string resulting in an error.
Even if the number is converted to a string type, when picgo uploads it does not recognize the MIME-Type due to the lack of a suffix, so picgo throws an exception.
A more complete solution is to get the MIME-TYPE of the image and convert it to the corresponding suffix. But here the fix directly adds a default suffix .png to the image, and after testing I found this to be the easiest and working solution.