Ticket #1040 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

File system mounted

Reported by: dread Owned by: thejimmyg
Priority: blocker Milestone: ckan-v1.4
Component: ckan Keywords:
Cc: nils.toedtmann Repository: ckan
Theme: none

Description

Public file path code adds a trailing , and thus adds / as a static file app in the Pylons middleware cascade.

Change History

comment:1 Changed 3 years ago by dread

  • Owner set to thejimmyg

Fixed by James in 904f1f36a672 for 1.3.2

comment:2 Changed 3 years ago by dread

  • Status changed from new to closed
  • Resolution set to fixed

comment:3 Changed 2 years ago by dread

  • Repository set to ckan
  • Theme set to none

The problem arises when you do two things together:

  1. Have code like this in a CKAN extension's plugin.py:
            config['extra_public_paths'] = ','.join([our_public_dir,
                    config.get('extra_public_paths', '')])
    

which will have a trailing blank value (unless you set extra_public_paths in the config file)

extra_public_paths=['/some/path/', '']
  1. Run CKAN with this code:
            extra_public_paths = config.get('extra_public_paths')
            if extra_public_paths:
                static_parsers = [StaticURLParser(public_path) \
                                  for public_path in \
                                  extra_public_paths.split(',')] + static_parsers
    

Introduced in #340 https://github.com/okfn/ckan/commit/0593c3e5050882a9dbf54fb6c263f4a2f1de2097#ckan/config/middleware.py in CKAN 1.0.2 This was made safer in https://github.com/okfn/ckan/commit/e0d5f02168116a18a7aeb7b058e4160bbd402a02#ckan/config/middleware.py for CKAN 1.3.2 (it ignores blank paths)

comment:4 Changed 2 years ago by dread

  • Cc nils.toedtmann added

comment:5 Changed 2 years ago by dread

Here are all the CKAN instances potentially involved in this issue:

ckan.net / DGU

These suffered this problem briefly and were fixed 15/3/11

opengov_es http://opengov.es/ 1.2

This does not have a theme extension. Is not serving files from root.

nosdonnees_fr http://www.nosdonnees.fr/ 1.3.1a

This does have a theme extension but does not seem to have a trailing blank public path since it is not serving files from root.

Note: See TracTickets for help on using tickets.