nea / MarkdownViewerPlusPlus

A Notepad++ Plugin to view a Markdown file rendered on-the-fly
MIT License
1.17k stars 143 forks source link

Notepad++ crashes when using image from invalid internet source #92

Open havlisimo opened 5 years ago

havlisimo commented 5 years ago

Issue description

Notepad++ crashes when I add image as a link which requires authentication . In my case I am trying to add GitLab pipeline status for a private repository on our local server.

Markdown to reproduce

[![pipeline status](https://git.my-company.cz/git/project-name/badges/dev/pipeline.svg)](https://git.my-company.cz/git/project-name/commits/dev)

Exceptions

When using valid url which requires authentication:

System.Net.WebException: The remote server returned an error: (401) Unauthorized.
   v System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   v System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   v System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)

When using invalid url

System.Net.WebException: Remote host cannot be found: 'git.my-company.cz'
   v System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   v System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   v System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)

Environment

nea commented 5 years ago

Hi @havlisimo

There is no common syntax to add credentials to an image link other than having the credentials in the URL. If that is not possible for your case I don't see any workaround.

Regarding the invalid url, yeah, that should be caught.

Sorry

sanchor commented 5 years ago

i've encountered the same problem, i assume, with the following error (503) message:

System.Net.WebException: 远程服务器返回错误: (503) 服务器不可用。 在 System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 在 System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result) 在 System.Net.WebClient.DownloadBitsResponseCallback(IAsyncResult result)

ffonz commented 3 years ago

Because of security reasons, I don't have an internet connection on my machine. When opening the README.md attached in the MarkdownViewerPlusPlus-0.8.2-x64.zip, I get the following exception (because of trying to read the image from the internet?):

See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

** Exception Text ** System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target machine actively refused it 138.91.141.243:443 at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)

I assume it is the same issue as described before. Could this issue get a high priority?

hgdagon commented 3 years ago

I'll just bump this 'cause I have the same issue even with local files (that do exist).