-
Notifications
You must be signed in to change notification settings - Fork 203
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
Fixes #2811 - Fixes mime type for some endpoints #2812
Conversation
The same issue was also happening to when you make a request to this route: |
@marimeireles I still see a request when testing out this branch on localhost: |
Thanks @miketaylr. I hadn't noticed that. |
@miketaylr have you tested on a clean profile? I've tested on firefox and chrome and both of them don't show the images anymore. |
|
It's a dumb hack, but what if we inserted the body content into an inert element.. maybe |
@miketaylr maybe I could also try https://developer.github.com/v3/media/#text |
No, |
Good point! |
Putting stuff inside a |
The images on the requests are the images from the first comment of the issue, aka, the description of the issue. |
I'm not sure it's terrible. What if we just added the |
Currently we do:
Ah, I see why not. However, why don't we just fix this on the python side of things on issue creation and make what we want the real title? @karlcow is there any reason we don't do that now? |
This solution Mike proposed didn't work. :/ |
so let's summarize here :)
So that's an interesting conundrum. When we discussed about the Content type, I pointed out to the comments API In there, there is the If I do I get in return (I removed the other parts of the issue):
DOMParserSo indeed this doesn't show image download, you can query the html, but unfortunately you can't convert to text. var myText = "<p><img src='http://localhost:5000/uploads/2019/2/36b4786d-da2a-41f6-9646-4662794c8aaa.jpeg'> </p>";
var myparser = new DOMParser();
var myfragment = myparser.parseFromString(myText , "text/html");
myfragment.body.innerHTML
// "<p><img src=\"http://localhost:5000/uploads/2019/2/36b4786d-da2a-41f6-9646-4662794c8aaa.jpeg\"> </p>"
myfragment.body.getElementsByTagName('p')
// HTMLCollection [ p ]
myfragment.body.getElementsByTagName('img')
// HTMLCollection [ img ]
myfragment.body.textContent
// " "
myfragment.body.innerText
// " " |
Let's rewind a bit the history of this:
Now we have on the python side access to
Some ideas:
|
Ah I had missed about the context of @miketaylr asking We can for the future. :) But that doesn't change we need to address the past. :) |
another funny thing, we could be less constrained if we had |
that's coming in the not too distant future. :) |
Thanks for trying to parse the content on DOM @karlcow. |
This new change fixed the issue for me... |
Can you please test @miketaylr ? If it works for you. -when you have the time |
Yep! Working here. |
@karlcow does it look good to merge? |
Ah missed this one. Sorry. I will check tonight in ~12h. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@marimeireles shortest 12h… review. I just decided to look at it anyway, before leaving here. And yes this is good. Thanks a lot @marimeireles
Hey @karlcow this problem is similar to #2802.
The problem here is that untriaged.js uses a different endpoint that I hadn't fixed:
/api/issues/category/needstriage?per_page=5