First I thought it was related to the recent SVG XSS fix, but it seems that I can’t get back to a working version, even by reverting everything until 8.15…
Steps to reproduce
Just have some file.rst, insert an image like this:
.. image:: http://some_url/image
What is the current bug behavior?
In gitlab’s file browser, the file is displayed as plain text.
What is the expected correct behavior?
Should be rendered like any other file (markdown or rst)
Link issues together to show that they're related or that one is blocking others.
Learn more.
Activity
Sort or filter
Newest first
Oldest first
Show all activity
Show comments only
Show history only
username-removed-107202changed title from Since 8.16.5, RST files are not properly rendered if they contain an image to Since 8.16.5, RST files are not properly rendered if they contain an SVG image
changed title from Since 8.16.5, RST files are not properly rendered if they contain an image to Since 8.16.5, RST files are not properly rendered if they contain an SVG image
username-removed-107202changed title from Since 8.16.5, RST files are not properly rendered if they contain an SVG image to RST files are not properly rendered if they contain an image
changed title from Since 8.16.5, RST files are not properly rendered if they contain an SVG image to RST files are not properly rendered if they contain an image
I don’t know how and why this broke, but I successfully “fixed” this on my gitlab instance by changing the file vendor/bundle/ruby/2.3.0/gems/gitlab-markup-1.5.1/lib/github/commands like this:
--- rest2html.old 2017-02-16 20:43:29.004451772 +0100+++ rest2html 2017-02-16 20:41:22.214000870 +0100@@ -144,7 +144,8 @@ self.body.pop() # add on `img` with attributes self.body.append(self.starttag(node, 'img', **atts))- self.body.append(self.context.pop())+ if self.context:+ self.body.append(self.context.pop())
Maybe there’s something deeper, but I didn’t try anything else.
Because, without this patch, you get:
% ./rest2html.old .. image:: http://coucouTraceback (most recent call last): File "./rest2html.old", line 196, in <module> sys.stdout.write("%s%s" % (main(), "\n")) File "./rest2html.old", line 182, in main parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS) File "/usr/lib/python2.7/site-packages/docutils/core.py", line 448, in publish_parts enable_exit_status=enable_exit_status) File "/usr/lib/python2.7/site-packages/docutils/core.py", line 662, in publish_programmatically output = pub.publish(enable_exit_status=enable_exit_status) File "/usr/lib/python2.7/site-packages/docutils/core.py", line 219, in publish output = self.writer.write(self.document, self.destination) File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write self.translate() File "/usr/lib/python2.7/site-packages/docutils/writers/_html_base.py", line 71, in translate self.document.walkabout(visitor) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 187, in walkabout visitor.dispatch_departure(self) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1895, in dispatch_departure return method(node) File "./rest2html.old", line 147, in depart_image self.body.append(self.context.pop())IndexError: pop from empty list
But, I found more: by downgrading from docutils 0.13.1 (was release in december 2016, so not long ago) to 0.12 (2014), my previous ./rest2html example works.
I guess on gitlab.com, docutils=0.12 is installed, but I have 0.13.1 installed (@Eijebong probably has version 0.13.1 too, as he’s using Archlinux on the server, I believe).
Proof:
gitlab@fenouil % cat test.rst.. image:: http://coucougitlab@fenouil % python -c "import docutils; print(docutils.__version__)" 0.13.1gitlab@fenouil % ./rest2html.old test.rstTraceback (most recent call last): File "./rest2html.old", line 196, in <module> sys.stdout.write("%s%s" % (main(), "\n")) File "./rest2html.old", line 182, in main parts = publish_parts(text, writer=writer, settings_overrides=SETTINGS) File "/usr/lib/python2.7/site-packages/docutils/core.py", line 448, in publish_parts enable_exit_status=enable_exit_status) File "/usr/lib/python2.7/site-packages/docutils/core.py", line 662, in publish_programmatically output = pub.publish(enable_exit_status=enable_exit_status) File "/usr/lib/python2.7/site-packages/docutils/core.py", line 219, in publish output = self.writer.write(self.document, self.destination) File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write self.translate() File "/usr/lib/python2.7/site-packages/docutils/writers/_html_base.py", line 71, in translate self.document.walkabout(visitor) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 174, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 187, in walkabout visitor.dispatch_departure(self) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1895, in dispatch_departure return method(node) File "./rest2html.old", line 147, in depart_image self.body.append(self.context.pop())IndexError: pop from empty list9:26 gitlab@fenouil % pip install docutils==0.12 --userCollecting docutils==0.12 Using cached docutils-0.12.tar.gzInstalling collected packages: docutils Running setup.py install for docutils ... doneSuccessfully installed docutils-0.13.1gitlab@fenouil % python -c "import docutils; print(docutils.__version__)" 0.12 gitlab@fenouil % ./rest2html.old test.rst <img alt="http://coucou" src="http://coucou" />
Using gitlab v9.1.0-rc3 (although I’m not 100% sure this updates github-markup as well, how do I make sure of this? I install gitlab by cloning the git repository, calling bundle install and all that stuff), this is broken with python-docutils=0.13.1 but it works with python-docutils=0.12.
The installed version of python3-docutils doesn’t change anything.
I haven't released a new "gitlab-markup" gem yet. Will do later today, but I can't promise it will be available in 9.2 as this is working well in omnibus install and I have some higher priority issues to tackle before the feature freeze for 9.2. If you want to try in a source install it should be easily to update the Gemfile and point to 1.6.0 version.
Gabriel Mazettochanged title from RST files are not properly rendered if they contain an image to RST files are not properly rendered if they contain an image (with docutils=0.13.1)
changed title from RST files are not properly rendered if they contain an image to RST files are not properly rendered if they contain an image (with docutils=0.13.1)