Solved? Changed forum url to path ... but it didn't change for uploads



    1. Installed Nodebb 1.7.x on a subdomain
    2. Performed a nodebb-plugin-import
    3. Looked at uploads and all were working fine
    4. Updated to Nodebb 1.10.x
    5. Switched from subdomain to a path /forums

    Expected result:
    The uploads would reflect the new sub-path.

    Actual result:
    The uploads do not include the /forums part of the path and therefore are giving 404s.


    I have 120k uploads. I hope there's an easy fix for this. I looked through the settings but I didn't find anything useful but I might've missed something.



  • Wait, what? Attachments are just links? 🤦

    Yeah, it's still a lot better than how older forums did it. And it kinda makes sense, then the file could live anywhere at the time of upload.

    But this basically makes it impossible to move attachments unless you write a script to re-write all the URLs. And I can't do symlinks in this situation either. 🤦 I'm just glad wordpress doesn't use an /uploads dir 😓



  • I created a redirect in HAProxy to handle the issue.


  • Global Moderator

    Why 1.7.x instead of the latest version? We're on 1.10.x now.

    This issue might be fixed already. That's why you should always use the latest version.



  • @PitaJ The nodebb-plugin-import plugin only works with 1.7.x and as mentioned in the steps, I'm currently on 1.10.x
    Since it the import process set the url in the post, it's probably a bug there.
    I could probably run a script to iterate over all the records and fix them and I probably will that but not today.



  • Turns out this is a bigger problem than I thought.

    Take a look at this topic.

    The only reason why you see images is because I manually changed the posts. Nearly every post in this topic has an image but it cannot be seen. I think this is a feature?

    Here's an example:

    Zuiho:
    
    ![DSCN1475.JPG](/uploads/_imported_attachments/migrated/595456_DSCN1475.JPG)
    ![DSCN1476.JPG](/uploads/_imported_attachments/migrated/595458_DSCN1476.JPG)
    

    But it should be:

    Zuiho:
    
    ![DSCN1475.JPG](/forums/assets/uploads/_imported_attachments/migrated/595456_DSCN1475.JPG)
    ![DSCN1476.JPG](/forums/assets/uploads/_imported_attachments/migrated/595458_DSCN1476.JPG)
    

    It seems the forum is not displaying any images unless the /forums is in the path. Normally not a problem unless you have a botched import like me.

    I have 1.2M posts and over 250k attachments, I'm not looking to re-process all the posts in the DB.

    Thoughts?
    cc: @baris @julian



  • Took me about an hour but I think I found the source of the issue:

    https://github.com/julianlam/nodebb-plugin-markdown/blob/5694fd8372e757d03cdcc552f736493eab0f182f/index.js#L326

    What's happening is that if a relative path is detected in a markdown url, this code checks that the relative path prefix is there. I'm not really sure why this is the case. If I'm running Wordpres (I am) and upload images there, shouldn't I be able to use relative URLs without enforcing the relative_path?

    (For my reference, the relative path is set based on the site url)


 

Suggested Topics

| |