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

Old presentations endup in 404 #430

Closed
SISheogorath opened this issue Apr 18, 2017 · 5 comments
Closed

Old presentations endup in 404 #430

SISheogorath opened this issue Apr 18, 2017 · 5 comments

Comments

@SISheogorath
Copy link
Contributor

I noticed that an old presentation (pre 0.5.0) is ending up in a 404 page. (but redirected correctly when clicking on Slide mode).

I guess this is a problem based on the migration from 0.4.x to 0.5.0. I did that month ago so a new migration wouldn't really be helpful. In general is there a way to "relink" the ids from the presentation to the original source? It would be annoying to copy every presentation into a new note as I gave some links to students I can't change anymore.

Would be helpful to have a ready database statement otherwise I have to figure it out myself later.

@jackycute
Copy link
Member

Hi @SISheogorath
That's weird.
We didn't change any id related db schema from 0.4.x to 0.5.0.
The slide mode will use the shortid after the /p/ url, and it's pretty much a stable path.
So could you check your db about how these notes look like?

@SISheogorath
Copy link
Contributor Author

SISheogorath commented Apr 18, 2017

Database looks fine 😕

Notes are stored in plaintext (like they should since 0.5.0) and also the shortid is fine. Even if I access /p/<shortid> directly I endup in a 404. Newly created notes (same content) work fine.

When I compare the data inside the data all columns of the node are identical besides the id, shortid, authorship (small difference in the last two section (I guess timestaps?)), and the timestamp entries.

I checked it back the redirect is identical, so it's not a shortid problem. But also the only error I see is the webserver say it has to report a 404. Not more. So it's not like there is a server-side exception or something.

I'm really hardly wondering how that happens .-. (Also tried up and downgrade between latest (docker image) and 0.5.0).

Very weird.


Edit (part 1):
My research says it has to happen here: https://github.com/hackmdio/hackmd/blob/0.5.1/lib/response.js#L190-L192


Edit (part 2):

I think I found the problem. It's related to shortid, but actually I don't understand it complete (maybe related to the charset?)

hackmd=# select title,viewcount,shortid from "Notes" WHERE title='git & Github';
    title     | viewcount |  shortid  
--------------+-----------+-----------
 git & Github |         2 | rJ31LYm0g
 git & Github |       171 | SJGhG2uA
(2 rows)

Fails:

hackmd=# select title,viewcount from "Notes" WHERE shortid='SJGhG2uA';
 title | viewcount 
-------+-----------
(0 rows)

While this works fine:

hackmd=# select title,viewcount from "Notes" WHERE shortid='rJ31LYm0g';
    title     | viewcount 
--------------+-----------
 git & Github |         2
(1 row)

Edit (part 3):

And I hunted the issue down /o\ OH MY GOSH WHAT A THING....

The problem is based on the fact that I switched from postgres:9.5 topostgres:9.5-alpine as database image. When I switch back to postgres:9.5 the first query works and the second (new one) doesn't.

😕 Postgres.........

@jackycute
Copy link
Member

@SISheogorath omg, you really hunted a ghost down.
I thought it was caused by the shortid package but result in a bigger one.

@jackycute
Copy link
Member

jackycute commented Apr 26, 2017

According to above comments, this issue is not directly related to us.
Close for now.

@bvanelli
Copy link

A bit late to the party, but I had the same exact issue. In my case, the issue went away after running a REINDEX on the table (or on the database, as a general fix), as some indexes can brake between postgres instances. Maybe this can help other people in the future, as I was clueless in the beginning.

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

No branches or pull requests

3 participants