Errors when using invalid url to insert an image #103

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

Projects

None yet

5 participants

@randrey
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
tomlane commented Dec 12, 2015

Relevant source

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

@hashhar
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
Contributor
hashhar commented Dec 12, 2015

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

@pekiZG
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
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
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
Contributor
hashhar commented Dec 12, 2015

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

@hashhar
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
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
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
pekiZG commented Dec 13, 2015

Great :)

@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 14, 2015
@hashhar hashhar Fixes #103. Tests pending. 70e31cd
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 14, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. c4bc924
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 18, 2015
@hashhar hashhar Fixes #103 with UX enhanced 4c106f9
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015
@hashhar hashhar Fixes #103. Tests pending. 5e5ede6
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. b11c4fd
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015
@hashhar hashhar Fixes #103 with UX enhanced 4542efb
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015
@hashhar hashhar Fixes #103. Tests pending. 394895b
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. 411724f
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 19, 2015
@hashhar hashhar Fixes #103 with UX enhanced 9760dca
@willduff willduff added the bug label Dec 19, 2015
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 21, 2015
@hashhar hashhar Fixes #103. Tests pending. a7041f0
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 21, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. ed04b27
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 21, 2015
@hashhar hashhar Fixes #103 with UX enhanced 52c3980
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 23, 2015
@hashhar hashhar Fixes #103. Tests pending. 27164ab
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 23, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. 770b5ab
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 23, 2015
@hashhar hashhar Fixes #103 with UX enhanced 533d9d1
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015
@hashhar hashhar Fixes #103. Tests pending. 0afb3d9
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. 710cca2
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015
@hashhar hashhar Fixes #103 with UX enhanced de36a99
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015
@hashhar hashhar Fixes #103. Tests pending. 04aba65
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015
@hashhar hashhar Fixes #103. Tests done. Localization pending. e19e06a
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 24, 2015
@hashhar hashhar Fixes #103 with UX enhanced 411bef0
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Dec 28, 2015
@hashhar hashhar Fixes issue #103 with UX enhanced cd6b304
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 4, 2016
@hashhar hashhar Fixes #103. Tests pending. ab0ac52
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 4, 2016
@hashhar hashhar Fixes #103. Tests done. Localization pending. 2abde36
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 4, 2016
@hashhar hashhar Fixes issue #103 with UX enhanced c72b932
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 12, 2016
@hashhar hashhar Fixes #103. Tests done. Localization pending. 73124dd
@hashhar hashhar added a commit to hashhar/OpenLiveWriter that referenced this issue Jan 12, 2016
@hashhar hashhar Fixes issue #103 with UX enhanced 6a26a44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment