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

[ERROR] Imgur uploads fail constantly for a duration of time #8

Closed
Raagaception opened this issue May 19, 2021 · 5 comments
Closed
Assignees

Comments

@Raagaception
Copy link

Hi, first of all, AMAZING plugin. Can't express how much this has helped in reducing clutter and making it easier to share .md files directly. But recently, Imgur uploads start giving errors constantly for no apparent reason:
image
This is what the console says :
image

I had this exact same error yesterday morning, but it fixed itself when I used Obsidian again in the evening. Any idea on what might be causing this seemingly random problem?

@Raagaception
Copy link
Author

image
... and as magically it had appeared, the issue went away after a system restart. Any idea about what might be going wrong at my end?

@gavvvr
Copy link
Owner

gavvvr commented May 19, 2021

I had this exact same error yesterday morning, but it fixed itself when I used Obsidian again in the evening.

Hi @Raagaception , I faced the same problem once last Saturday. I was on a call and wanted to paste a screenshot to Obsidian quickly: there was the same message about error instead of a pasted image. I decided that I probably messed up with my vault or my secret somehow expired and pasted the image to other app. After the call I tried to paste it to Obsidian again and it worked!
I checked the console and I believe there was the same message about CORS 🤔

CORS request is a thing that asks a remote server (Imgur in our case) for permission from your browser (an electron-based Obsidian app in our case) to perform a POST request (to upload image in our case). And seems like sometimes Imgur can refuse (maybe under heavy load or whatever reason).

So, there is nothing on my source code side. What I can do is to catch this CORS error and modify an error message to something like:

Imgur refused image upload, please try again later

Thanks for submitting the problem

@Raagaception
Copy link
Author

I see. Nothing can be done if it's Imgur's fault, but can you make it so that whenever upload fails, it pastes the file the normal way instead, along with the error message and the console message?

@gavvvr gavvvr self-assigned this May 19, 2021
@gavvvr
Copy link
Owner

gavvvr commented May 19, 2021

Agree, this can be improved: If the paste fails it will be better to fall back to default image handling strategy.

@Raagaception, if you face an issue again, could you please check the network tab of dev console and attach complete response information (status code, headers)?

@Raagaception
Copy link
Author

Sure, I will. No idea why I didn't think of doing it earlier. Let this thread be open till the issue strikes again.

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

2 participants