Git Product home page Git Product logo

Comments (3)

davidread avatar davidread commented on August 18, 2024

You're quite right.

How about changing it to:

api_url = urlparse.urljoin(context['site_url'] + '/', 'api/action')

Perhaps you could create some pull requests with this or similar change?

from ckanext-qa.

dlax avatar dlax commented on August 18, 2024

Yes I could. However, I'm not sure what the proper way to fix this. Sure your suggestion would work, but since this appears to be broken in other extensions as well, I was looking for a standard way to handle this... And looking into ckan source code, I could find a few different "solutions":

  • controllers/feed.py has '/'.join([site_url, resource_path]) and also base_url + h.url_for(controller='package', ...)

  • controllers/package.py has
    c.datastore_api = '%s/api/action' % \ config.get('ckan.site_url', '').rstrip('/')
    similar things in lib/dictization/model_dictize.py or model/package.py

  • lib/cli.py has

    fetch_url = config['ckan.site_url']
    url = h.url_for(controller='package', action='read', id=dd['name'])
    url = urlparse.urljoin(fetch_url, url[1:]) + '.rdf'
    

    which, I guess, would also fail in case site_url has a path component.

Did I miss something or should we really go and fix all usages of urljoin the way you suggests?

from ckanext-qa.

wardi avatar wardi commented on August 18, 2024

site_url shouldn't have path components, that's what root_path is for. The url_for helper can be used to generate full paths correctly, I think.

from ckanext-qa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.