upload icon indicating copy to clipboard operation
upload copied to clipboard

Integration with fof/pages: File rendering & download should work outside of original post

Open JeromeGillard opened this issue 2 years ago • 1 comments

Bug Report

Current Behavior Uploaded files are not rendered in fof/pages. Uploaded files cannot be downloaded fof/pages.

Steps to Reproduce

  • create a post, let's say it has route /d/1-test
  • upload a file and insert it as bbcode in the post: [upl-file uuid=e737f663-f38f-4d93-9d1c-5ec7abd4b19c size=2kB url=https://www.test.com/assets/files/2022-10-12/1665582177-619189-tes.gpx]test.gpx[/upl-file]
  • create a fof/page , let's say it has route /p/2-new-page
  • paste the same bbcode in the page
  • error: the file cannot be displayed nor downloaded

Expected Behavior The bbcode [upl-file uuid=e737f663-f38f-4d93-9d1c-5ec7abd4b19c size=2kB url=https://www.test.com/assets/files/2022-10-12/1665582177-619189-tes.gpx]test.gpx[/upl-file] should be working on pages.

Environment

  • Flarum version: 1.3.0
  • Extension version: 1.2.3

Possible solution(s)

A workaround is to create a post that has the same post.id than the page route's. Then it works. But the page existence is now tied to another public post.

Additional Context

  • ideally, a file should not depend on a post's existence
  • having a uuid in the bbcode should make size & url redundant.
  • having url in the bbcode is a big problem for domain name portability
  • Having the rendering to fetch the file to yet another URL like /api/fof/download/e737f663-f38f-4d93-9d1c-5ec7abd4b19c/2-new-page/2A2AZKCJO8dHR907FnyRBQBf2by07jKUzNVFrxo0 is odd. Why include the current route instead of the original one?

JeromeGillard avatar Oct 12 '22 21:10 JeromeGillard

@JeromeGillard Can you please try to reproduce your described issue on the latest version of fof/upload again? In the meantime there were quite some changes to this extension.

DavideIadeluca avatar Jun 22 '24 15:06 DavideIadeluca