Skip to content

Commit

Permalink
Default API_URL to SITE_URL if missing
Browse files Browse the repository at this point in the history
Otherwise file uploads and other calls where broken when using CKAN in
a non-root location.
  • Loading branch information
amercader committed Oct 29, 2013
1 parent e4fc2fa commit 500733e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ckan/public/base/javascript/client.js
Expand Up @@ -370,7 +370,7 @@
});

ckan.sandbox.setup(function (instance) {
instance.client = new Client({endpoint: ckan.API_ROOT});
instance.client = new Client({endpoint: ckan.SITE_ROOT});
});

ckan.Client = Client;
Expand Down
4 changes: 3 additions & 1 deletion ckan/public/base/javascript/main.js
Expand Up @@ -29,7 +29,9 @@ this.ckan = this.ckan || {};

ckan.SITE_ROOT = getRootFromData('siteRoot');
ckan.LOCALE_ROOT = getRootFromData('localeRoot');
ckan.API_ROOT = getRootFromData('apiRoot');

// Not used, kept for backwards compatibility
ckan.API_ROOT = body.data('apiRoot') || ckan.SITE_ROOT;

// Load the localisations before instantiating the modules.
ckan.sandbox().client.getLocaleData(locale).done(function (data) {
Expand Down

0 comments on commit 500733e

Please sign in to comment.