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

Errors when using invalid url to insert an image #103

Closed
randrey opened this Issue Dec 12, 2015 · 11 comments

Comments

Projects
None yet
5 participants
@randrey
Copy link

randrey commented Dec 12, 2015

  1. Go to Insert -> Picture -> From the web
  2. Type in an invalid url and cilck Insert. It will ask if you want to continue. Say Yes.
    picturefromtheweb

It will add a placeholder image and show an error
uriexception

Adding a hyperlink to the placeholder image throws a NullRefException.

@tomlane

This comment has been minimized.

Copy link

tomlane commented Dec 12, 2015

Relevant source

What should be done here? A more friendly error message?

@hashhar

This comment has been minimized.

Copy link
Contributor

hashhar commented Dec 12, 2015

I second this. We should check that object for null and tell the user what actually happened. Can I do this?

@hashhar

This comment has been minimized.

Copy link
Contributor

hashhar commented Dec 12, 2015

On second thought, why do we allow invalid links in the first place?

@pekiZG

This comment has been minimized.

Copy link

pekiZG commented Dec 12, 2015

@hashhar make a fork, clone it localy and then make a pull req.
We should put it into wiki :)

@hashhar

This comment has been minimized.

Copy link
Contributor

hashhar commented Dec 12, 2015

Thanks. One clarification I need is that whether we need to disallow invalid links or simply provide a better help message.

@pekiZG

This comment has been minimized.

Copy link

pekiZG commented Dec 12, 2015

@hashhar I was thinking two things

  1. Don't trust user input. If you can not correct what user entered inform him that there is something wrong.
  2. If you know how good "payload" looks like accept it; everything else gets rejected with appropriate message to the user.

/me thinks option number two is better

@hashhar

This comment has been minimized.

Copy link
Contributor

hashhar commented Dec 12, 2015

I'll try and get a pull ready by tomorrow. Excited.

@hashhar

This comment has been minimized.

Copy link
Contributor

hashhar commented Dec 13, 2015

I got upto this

How can I display a nice error message that says "We couldn't find an image at the link you just entered." and two buttons, one for "Edit Link" which should take the user back to the form where they enter the link and the other for "Cancel" which should stop the image insertion and get them back to the editorContext.

And where is the dialog in the image above being called? I spent a lot of time trying to read through the stack traces by inserting breakpoints. I am not used to string resources (I could've just Ctrl + Fed the relevant words but they led me to the resource files.

I was able to use DisplayMessage.Show() but I couldn't figure out a way to change the dialog's contents other than the predefined ones set by the MessageId enum.

@pekiZG

This comment has been minimized.

Copy link

pekiZG commented Dec 13, 2015

@hashhar, think I read somewhere here that enum is being generated from somewhere.
Guessing some .resx file or something similar.

Look through issues dealing with localization. Ill link it here if I find it again.

EDIT:
Rationalize localization strings
#7

Fix localization across the build and install
#2

Maybe @writeline could help/explain :)

@hashhar

This comment has been minimized.

Copy link
Contributor

hashhar commented Dec 13, 2015

I found the resx though. So I have to add the relevant xml to the resx and then call the DisplayMessage.Show() with the generated MessageId

@pekiZG

This comment has been minimized.

Copy link

pekiZG commented Dec 13, 2015

Great :)

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 14, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 14, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 18, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015

@willduff willduff added the bug label Dec 19, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 21, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 21, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 21, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 23, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 23, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 23, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 28, 2015

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 4, 2016

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 4, 2016

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 4, 2016

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 12, 2016

hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 12, 2016

ScottIsAFool added a commit that referenced this issue Jan 17, 2016

Merge pull request #121 from hashhar/issue-103
Fix error #103 when inserting image from web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment