mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-27 22:49:56 -05:00
9aa43ec751
no issue - updates the `TrailingHistory` locationType so that trailing slashes aren't added to the end of URLs with parameters but instead matches how the server-side redirects to trailing-slash URLs - before: `/subscribers?order=created_at/` - after: `/subscribers/?order=created_at`
23 lines
523 B
JavaScript
23 lines
523 B
JavaScript
import Ember from 'ember';
|
|
|
|
const {HistoryLocation} = Ember;
|
|
|
|
let trailingHistory = HistoryLocation.extend({
|
|
formatURL() {
|
|
let url = this._super(...arguments);
|
|
|
|
if (url.indexOf('?') > 0) {
|
|
return url.replace(/([^\/])\?/, '$1/?');
|
|
} else {
|
|
return url.replace(/\/?$/, '/');
|
|
}
|
|
}
|
|
});
|
|
|
|
export default {
|
|
name: 'registerTrailingLocationHistory',
|
|
|
|
initialize(application) {
|
|
application.register('location:trailing-history', trailingHistory);
|
|
}
|
|
};
|