View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003525 | Composr alpha bug reports | [All Projects] General / Uncategorised | public | 2018-02-02 02:25 | 2018-02-06 15:48 |
Reporter | Chris Graham | Assigned To | Salman | ||
Severity | Feature-request | ||||
Status | resolved | Resolution | fixed | ||
Summary | 0003525: $util.url is naive | ||||
Description | This URL puts on the full base URL. We very rarely want to do that, because this will break AJAX scripts if running across multiple domains (unless crossdomain config works well, which I don't want to assume). If running across multiple domains if possible we want our AJAX script to come from our own domain. Composr makes all URLs available from all domains, it is only the full page requests which are modified to assume a certain zone is running. $BASE_URL_NOHTTP will produce a relative base URL. E.g. if running on http://example.com/composr, it will return "/composr". I suggest changing it to use $BASE_URL_NOHTTP. Then for the very rare cases where that won't work, explicitly pass $cms.getBaseUrl(). Btw, is there some technical reason the function is using {$BASE_URL} right now rather than $cms.getBaseUrl() internally? Probably, but if not, fix that too (but using $cms.getBaseUrlNohttp() of course). I know this is a bit weird and complex, but we need to support these more complex configurations. | ||||
Tags | No tags attached. | ||||
Sponsorship open | |||||
|
Fixed by https://github.com/ocproducts/composr/commit/6808c50844db063cc1a0dda2171c38cbb1eca8f0 I introduced a new function called $util.rel() for producing root-relative URLs and used it throughout the JS where appropriate. $util.url() is a general purpose function that returns a "URL"[1] instance, which can be used for URL manipulation, modifying the query string etc. but unfortunately it only works with absolute URLs. The reason for using the tempcode {$BASE_URL} in $util.url() is to avoid UTIL.js having any dependency on CMS.js. $cms.getBaseUrl() would work too, should I switch? 1: https://developer.mozilla.org/en-US/docs/Web/API/URL |
|
That sounds fine. " $cms.getBaseUrl() would work too, should I switch?" - no, your decision sounds fine. |
Date Modified | Username | Field | Change |
---|---|---|---|
2018-02-02 02:25 | Chris Graham | New Issue | |
2018-02-02 02:25 | Chris Graham | Status | non-assigned => assigned |
2018-02-02 02:25 | Chris Graham | Assigned To | => Salman |
2018-02-06 06:07 | Salman | Note Added: 0005442 | |
2018-02-06 06:07 | Salman | Status | assigned => resolved |
2018-02-06 06:07 | Salman | Resolution | open => fixed |
2018-02-06 15:48 | Chris Graham | Note Added: 0005444 | |
2023-02-26 18:29 | Chris Graham | Category | General => General / Uncategorised |