Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing Fragment Space(s) #4198

Open
kev22257 opened this issue Jun 15, 2018 · 1 comment
Open

Trailing Fragment Space(s) #4198

kev22257 opened this issue Jun 15, 2018 · 1 comment

Comments

@kev22257
Copy link

We have fragments that have a space at the end (outbound/22130600/po/powithspacetest%20). When trying to navigate to this fragment Backbone is stripping the trailing space in getFragment().

        var M = /^[#\/]|\s+$/g;

        getFragment: function(t) {
            if (t == null) {
                if (this._usePushState || !this._wantsHashChange) {
                    t = this.getPath()
                } else {
                    t = this.getHash()
                }
            }
            return t.replace(M, "")
        },

I can understand removing the bits at the start of the fragment, but can someone explain the motivation for removing the space(s) at the end? This causes our app to fail to lookup the requested data because the part with the space is a param in the router.

routes: {
                "": "home",
                "outbound/:tieBack/po/:poNbr": "outboundDetail"
            },

And

            outboundDetail: function(tieBack, poNbr) {
                app.switchOutboundDetail(tieBack, poNbr);
            },
@jgonggrijp
Copy link
Collaborator

Since somebody went out of his or her way to strip trailing spaces, it's probably a solution to some kind of problem, so I'll need to consult the version history in order to find the rationale. In any case, I agree it seems a bit overzealous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants