Invalid image path crashes the comment view (500 error for issue JSON, InvalidURIError)
Summary
Comments are not loading for an issue. Probably due to an EXIF rotated image in the comments? Probably because a comment has some invalid (image) Markdown. Getting a 500 error for the JSON data. See log below.
This is the maligned image: Landscape_8
Steps to reproduce
Unable to reproduce on gitlab.com with the same image.
What is the current bug behavior?
Red bar, cannot load comments.
What is the expected correct behavior?
Comments load
Relevant logs and/or screenshots
Started GET "/h5mag/h5mag/issues/848.json?serializer=sidebar" for 192.168.1.73 at 2018-03-27 10:02:05 +0000
Completed 500 Internal Server Error in 52ms (ActiveRecord: 7.3ms)
Addressable::URI::InvalidURIError (Cannot assemble URI string with ambiguous path: '/h5mag/h5mag/uploads/dc926a8ebc3304f4c7bf5bdd01e40007/Landscape_8.jpg
the image appears as it should - with the bottom at the bottom :thumbsup:'):
lib/banzai/filter/relative_link_filter.rb:61:in `process_link_to_upload_attr'
lib/banzai/filter/relative_link_filter.rb:46:in `process_link_attr'
lib/banzai/filter/relative_link_filter.rb:22:in `block in call'
lib/banzai/filter/relative_link_filter.rb:21:in `call'
lib/banzai/pipeline/base_pipeline.rb:21:in `block (2 levels) in singleton class'
lib/banzai/object_renderer.rb:61:in `block in post_process_documents'
lib/banzai/object_renderer.rb:59:in `map'
lib/banzai/object_renderer.rb:59:in `post_process_documents'
lib/banzai/object_renderer.rb:35:in `render'
app/services/notes/render_service.rb:18:in `execute'
app/controllers/concerns/renders_notes.rb:7:in `prepare_notes_for_rendering'
app/controllers/concerns/issuable_actions.rb:86:in `discussions'
lib/gitlab/i18n.rb:50:in `with_locale'
lib/gitlab/i18n.rb:56:in `with_user_locale'
app/controllers/application_controller.rb:330:in `set_locale'
lib/gitlab/middleware/multipart.rb:95:in `call'
lib/gitlab/request_profiler/middleware.rb:14:in `call'
lib/gitlab/middleware/go.rb:17:in `call'
lib/gitlab/etag_caching/middleware.rb:11:in `call'
lib/gitlab/middleware/read_only/controller.rb:28:in `call'
lib/gitlab/middleware/read_only.rb:16:in `call'
lib/gitlab/request_context.rb:18:in `call'
lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
lib/gitlab/middleware/release_env.rb:10:in `call'
Results of GitLab environment info
System information
System: Ubuntu 14.04
Current User: git
Using RVM: no
Ruby Version: 2.3.6p384
Gem Version: 2.6.13
<main>: warning: pthread_create failed for timer: Invalid argument, scheduling broken
Bundler Version:1.13.7
Rake Version: 12.3.0
Redis Version: 3.2.11
Git Version: 2.14.3
Sidekiq Version:5.0.5
Go Version: unknown
GitLab information
Version: 10.6.0
Revision: 8f82e53
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: postgresql
URL: http://gitlab.local.schuttelaar.net
HTTP Clone URL: http://gitlab.local.schuttelaar.net/some-group/some-project.git
SSH Clone URL: git@gitlab.local.schuttelaar.net:some-group/some-project.git
Using LDAP: no
Using Omniauth: no
GitLab Shell
Version: 6.0.4
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks
Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Checking GitLab Shell ...
GitLab Shell version >= 6.0.4 ? ... OK (6.0.4)
Repo base directory exists?
default... yes
Repo storage directories are symlinks?
default... no
Repo paths owned by git:root, or git:git?
default... yes
Repo paths access is drwxrws---?
default... yes
hooks directories in repos are links: ...
5/3 ... ok
5/4 ... ok
5/5 ... ok
5/7 ... ok
5/8 ... ok
5/9 ... ok
5/10 ... ok
5/11 ... ok
6/12 ... repository is empty
11/14 ... ok
5/15 ... ok
17/16 ... repository is empty
5/17 ... ok
5/18 ... ok
9/19 ... ok
11/20 ... ok
11/21 ... ok
11/22 ... ok
11/23 ... ok
11/26 ... ok
11/27 ... ok
5/28 ... ok
11/29 ... ok
5/30 ... ok
11/31 ... ok
5/32 ... ok
11/33 ... ok
5/34 ... repository is empty
11/37 ... ok
5/38 ... ok
11/39 ... ok
11/40 ... ok
11/42 ... ok
11/43 ... ok
11/44 ... ok
11/46 ... ok
5/47 ... ok
5/48 ... ok
11/49 ... ok
11/50 ... repository is empty
11/51 ... ok
11/52 ... ok
11/53 ... ok
11/54 ... ok
11/55 ... ok
5/56 ... ok
5/57 ... ok
11/58 ... ok
11/59 ... ok
11/60 ... ok
11/61 ... ok
11/62 ... ok
11/63 ... ok
11/64 ... ok
11/65 ... ok
11/66 ... ok
11/67 ... ok
11/68 ... ok
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
<main>: warning: pthread_create failed for timer: Invalid argument, scheduling broken
Check GitLab API access: OK
Redis available via internal API: OK
Access to /var/opt/gitlab/.ssh/authorized_keys: <main>: warning: pthread_create failed for timer: Invalid argument, scheduling broken
OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Sidekiq ...
Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Reply by email is disabled in config/gitlab.yml
Checking LDAP ...
LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
5/3 ... yes
5/4 ... yes
5/5 ... yes
5/7 ... yes
5/8 ... yes
5/9 ... yes
5/10 ... yes
5/11 ... yes
6/12 ... yes
11/14 ... yes
5/15 ... yes
17/16 ... yes
5/17 ... yes
5/18 ... yes
9/19 ... yes
11/20 ... yes
11/21 ... yes
11/22 ... yes
11/23 ... yes
11/26 ... yes
11/27 ... yes
5/28 ... yes
11/29 ... yes
5/30 ... yes
11/31 ... yes
5/32 ... yes
11/33 ... yes
5/34 ... yes
11/37 ... yes
5/38 ... yes
11/39 ... yes
11/40 ... yes
11/42 ... yes
11/43 ... yes
11/44 ... yes
11/46 ... yes
5/47 ... yes
5/48 ... yes
11/49 ... yes
11/50 ... yes
11/51 ... yes
11/52 ... yes
11/53 ... yes
11/54 ... yes
11/55 ... yes
5/56 ... yes
5/57 ... yes
11/58 ... yes
11/59 ... yes
11/60 ... yes
11/61 ... yes
11/62 ... yes
11/63 ... yes
11/64 ... yes
11/65 ... yes
11/66 ... yes
11/67 ... yes
11/68 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.3.5 ? ... yes (2.3.6)
Git version >= 2.9.5 ? ... yes (2.14.3)
Git user has default SSH configuration? ... yes
Active users: ... 18
Checking GitLab ... Finished
Edited by Joost Schuttelaar