DisboxApp / web

Use Discord as a file storage service.
https://disboxapp.github.io/web/
GNU Affero General Public License v3.0
470 stars 87 forks source link

I can't access the UI after creating a folder with a / in its name #51

Closed cristianpenaarriero closed 1 year ago

cristianpenaarriero commented 1 year ago

After creating a folder with a / character, the UI just becomes blank before the files load. Screenshot

How can I access the files again?

DisboxApp commented 1 year ago

Hey, this seems to a be a bug where validation against doing that is missing, I'll fix that soon.

For the meanwhile, here's a manual fix:

  1. Open F12 and go to Network tab, then refresh the page
  2. The first (or second, find the non-empty one) should be requesting all your files metadata.
  3. Go to the preview tab and browse the response (expand directories until you reach the path) until you find the file with a / in it's name.
  4. Take the last URL part of that request (token), the id attribute of the file you found, and your new desired file name, and replace them accordingly in this script:
const token = "<PUT_YOUR_TOKEN_HERE>";
const fileId ="<PUT_YOUR_FILE_ID_HERE>";
const newFileName = "<PUT_YOUR_NEW_FILE_NAME_HERE>";

var myHeaders = new Headers();
myHeaders.append("Accept", "*/*");
myHeaders.append("Accept-Language", "he");
myHeaders.append("Connection", "keep-alive");
myHeaders.append("Origin", "https://disboxapp.github.io");
myHeaders.append("Referer", "https://disboxapp.github.io/");
myHeaders.append("Sec-Fetch-Dest", "empty");
myHeaders.append("Sec-Fetch-Mode", "cors");
myHeaders.append("Sec-Fetch-Site", "cross-site");
myHeaders.append("sec-ch-ua", "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"");
myHeaders.append("sec-ch-ua-mobile", "?0");
myHeaders.append("sec-ch-ua-platform", "\"Windows\"");
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "name": newFileName 
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch(`https://disboxserver.azurewebsites.net/files/update/${token}/${fileId}`, requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));
  1. Head over to the console tab on F12, paste, and run that script.

This makes an API call to rename your file :)

Sorry for the trouble and let me know if you need more help 😄