any way we can reduce the hash length for attached files w/ export code?

Hi Team.

[not sure if this is site feedback or community help]

I am currently trying to upload the exported files from a notebook, which has attached files. The hashes used for the attached files are very long, and when I upload them to either MS Azure or AWS S3 (haven’t tried GitHub yet), the names keep getting truncated and, consequently, the files aren’t being referenced correctly when called from the index.html doc. Any way to get around this?

btw: here’s an example of what happens when one just trying to upload these files:



(same problem on both platforms)

Where do the names get truncated? That is, at/after which step?

Upon upload to AWS or Azure. And both truncate in the exact same way.

Can you share an example of original name vs truncated name?

Absolutely :slight_smile:



I don’t think that’s either AWS’ or Azure’s fault. I suspect that your OS may have already shortened the name. Are you on Windows? Can you inspect the file’s properties and share a screenshot of that?

1 Like

Sorry for the slow reply. The name is not truncated after untar in my file explorer. The change only is only apparent after upload.

…But indeed you are correct that it has something to do with Windows :slight_smile: After switching to Linux and uploading, everything works well:

As for Windows: I am perplexed. When I look at the directory, I see full names. When I look at a file’s properties, I see the same truncating pattern in the file path (file name wasn’t shown in properties) … so what I see is not what I get.

I am very appreciative that this is solvable and very grateful that you showed me how to do so, but I am lost as to why this would look one way in the file Explorer but be interpreted entirely differently behind the scenes.

  • How do you upload those files in Windows? Do you have your Azure / S3 cloud storage mounted somehow and then drag them over?
  • Do shorter file names change as well (if they’re longer than 11 characters including extension)?
  1. I use the web UI in both instances and drag and drop. I did the same on Linux.
  2. No, all hashed js files that arent’ in the files folder in the notebook archive do not transform

I’m not sure I understand. Do you mean to say that you dragged the files directly from within the archive, without extracting it first?

No, I extracted the archive, them dragged and dropped. The image above in Windows shows the extracted files. In the file explorer, these all read with their full file names. However, dropping them into the AWS and Azure web UIs, they get truncated.

Performing this operation in the exact same way (except that I used tar xvf to unzip, rather than 7zip), I get the truncated names. It’s baffling.

I assume the same thing happens when you attach one of these files to a notebook?

Edit: You can also try the following. Add these two cells to a notebook:

viewof file = Inputs.file()

Then choose one of those files.

I have not tried creating a notebook and attaching the files. These are downloaded from a notebook using ‘export code’. The hashes are Observable transformations of the filename… I assume using SHA or equivalent… and I assume to prevent storage of duplicate files.

Let me try…

Yes, when I drag and drop into the file attachments, same truncating behavior occurs. Same when I use the input button. Though when I select the file, the full name is given in the file selection interface.

Windows must have some strange ‘aliasing’ behavior that shows a different name compared to how it is “actually” stored: