psi-4ward / psitransfer

Simple open source self-hosted file sharing solution.
BSD 2-Clause "Simplified" License
1.46k stars 211 forks source link

Setting "uploadAppPath" results to an error #242

Closed merentitis closed 1 year ago

merentitis commented 1 year ago

I used to have "uploadAppPath": '/upload', with an Apache reverse proxy and was working fine. After updating to the latest version (after a couple of years), my current config results to the following error after pressing the upload button:

tus: unexpected response while creating upload, originated from request (method: POST, url: /files, response code: 404, response text: <!DOCTYPE html> <html lang="en"> <head> <base href="/"> <meta charset="utf-8"> <title>GRNET WebTransfer</title> <link href="assets/favicon.ico" rel="icon" type="image/x-icon"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="robots" content="noindex,nofollow"> <meta http-equiv="x-ua-compatible" content="IE=edge"> <link href="assets/styles.css" rel="stylesheet"> <script> // Add ployfills for stupid IE if (document.documentMode || /Edge/.test(navigator.userAgent)) { (function(d, script) { script = d.createElement('script'); script.type = 'text/javascript'; script.async = false; script.src = 'assets/babel-polyfill.js'; d.getElementsByTagName('head')[0].appendChild(script); }(document)); } </script> <style> html { position: relative; min-height: 100%; } body > .container { padding-bottom: 50px; position: relative; } .footer { position: absolute; bottom: 0; width: 100%; height: 40px; line-height: 40px; } </style> </head> <body> <div class="container"> <h1> <svg class="fa-icon" role="presentation" viewbox="0 0 1920 1792" style="fill: #0275D8"> <path d="M1280 864q0-14-9-23l-352-352q-9-9-23-9t-23 9l-351 351q-10 12-10 24 0 14 9 23t23 9h224v352q0 13 9.5 22.5t22.5 9.5h192q13 0 22.5-9.5t9.5-22.5v-352h224q13 0 22.5-9.5t9.5-22.5zM1920 1152q0 159-112.5 271.5t-271.5 112.5h-1088q-185 0-316.5-131.5t-131.5-316.5q0-130 70-240t188-165q-2-30-2-43 0-212 150-362t362-150q156 0 285.5 87t188.5 231q71-62 166-62 106 0 181 75t75 181q0 76-41 138 130 31 213.5 135.5t83.5 238.5z"></path> </svg> PsiTransfer </h1> <hr> <p class="alert alert-danger"><strong><i class="fa fa-fw fa-exclamation-triangle"></i> Download bucket not found.</strong></p> <p><a class="btn btn-sm btn-info" title="New Upload" href="/upload/"><i class="fa fa-fw fa-cloud-upload"></i> new upload</a></p> </div> <footer class="footer"> <div class="container text-right"><span class="text-muted"><a href="https://github.com/psi-4ward/psitransfer" target="_blank">Powered by PsiTransfer</a></span></div> </footer> </body> </html>, request id: n/a)

psi-4ward commented 1 year ago

url: /files looks like you set the variable wrong? look into your upload-html source, there should be PSITRANSFER_UPLOAD_PATH = '/upload';

merentitis commented 1 year ago

I am sorry but didn't quite understand what I should do. What do you mean by setting the variable wrong? I set the variable in config.dev.js file as suggested:

  // use to set custom upload url (subfolder to baseUrl)
  "uploadAppPath": '/',

my setting: "uploadAppPath": '/upload', Thank you

psi-4ward commented 1 year ago

https://github.com/psi-4ward/psitransfer/blob/master/config.js#L65

so you run PsiTransfer with NODE_ENV=dev environment variable set? Otherwise config.dev.js would not be loaded. I would suggest to set your config directly in config.js

merentitis commented 1 year ago

I sorted this out. It seems that something has changed in upload.pug

diff upload.pug upload.pug.old 
18d17
<     script PSITRANSFER_UPLOAD_PATH = '#{uploadAppPath}';

I had mapped the old file, I now mapped the new one and everything seems to work fine. Sorry for the trouble!

For the record, the change occured to this commit