Albretch Mueller (12023-04-26): > Yes, you could but I am trying to find out why this is happening > instead of truncating the string when a space appears because I don't > think what would be safe.
shaXsum always writes X/4 hexadecimal nibbles then two spaces then the file name. If the input is from stdin, then the convention is the file name is ‘-’. (Well, not always always: if the file name contains very special characters, it will use an escaped output format. And there is the -z option.) For your case, just use “cut -c 1-64”. > > Why the detour over base64? > because I would like to include the three strings in the file descriptor: > a) the crazy long name > b) its base64 representation > c) §b's sha256sum representation which is the one used for the file > name and the log of the download. Then do so, but in c, store the SHA-256 of the URL, not the SHA-256 of the base64 encoding of the URL. > The local copies should represent the web URLs as close as possible > in order to minimize "what came from where" kinds of confusions. You are right to do so. Many utilities rely on the extension to decide what to do with a file. Lacking a standardized place to store the file type, it is the most robust options. Applications that rely on probing and heuristics, like libfile and co., are in fact much less reliable and a lot more annoying. (Also, if we were to want a standardized place to store the file type, a lot of user interface would have to be revamped.) OTOH, HTTP does have a place to state the type of the file, and the extension in URLs is not reliable: if you want to do it properly, you must set your local file extension based on the Content-Type response header. > Also > from the same URL you would then download the corresponding pdf file > with exactly the same name, the only difference being the extension. Then you need to exclude the extension from the URL, but a lot of URLs do not have extensions and you should be using the Content-Type instead. This feature is a pipe dream. > This is the first time I have seen blank spaces and hyphens in a text > segment's sum. Those characters might be confusing. See above. Regards, -- Nicolas George
signature.asc
Description: PGP signature