Skip to content
This repository

Overriding URL for a revision creates an invalid url for a revision=>404 #59

Closed
msevestre opened this Issue · 8 comments

2 participants

Michael Sevestre Jean-Philippe Boily
Michael Sevestre
Collaborator

Step to reproduce
1 - Create a new blog entry
2 - Set the URL to "blah"
3 - Save the post

Going to the home page (not in the admin section), the newly created blog is visible and the url points to /blah
However clicking on the url returns a 404

The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.

Jean-Philippe Boily
Owner

What is the mount point of your app? I suspect it is not root maybe?

Michael Sevestre
Collaborator

yes indeed.
mount Monologue::Engine, :at => "/monologue"

This is using the default mount point in the dummy application
I'll try to write a test to reproduce that error

Jean-Philippe Boily
Owner

It is not a bug in Monologue in fact. If it is mounted in "/monologue", it can't handle any route of the main_app, only it's own routes in "/monologue/whatever".

Any suggestion? Maybe a validation to make sure url is starting with mount point?

Michael Sevestre
Collaborator

Well I believe this is more a 'Monologue' bug than a 'user' bug. A non tech-savvy user might have some trouble understanding why this behaves like that.

My suggestion would be:
1 - in posts_revisions, do not prepend #{Monologue::Engine.routes.url_helpers.root_path} when generating a url

self.url = "{year}/#{self.title.parameterize}" if self.url.nil? || self.url.strip == ""

instead of

self.url = "#{Monologue::Engine.routes.url_helpers.root_path}#{year}/#{self.title.parameterize}" if self.url.nil? || self.url.strip == ""

2 - Then instead of using

use sthg like

The url are then consistent and do not depend on the mounted path.
Does it make sense?

Jean-Philippe Boily
Owner

Would certainly make sense! Thanks for the suggestion.

Michael Sevestre
Collaborator

I'll make a pull request :-)

Michael Sevestre
Collaborator

hum..I just tried with prepending /monologue to my previous url. It still does not work.
The path looks like /monologue/blah but I still get a 404
Maybe a routing problem?

Jean-Philippe Boily jipiboily closed this
Jean-Philippe Boily
Owner

PR #64 was merged. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.