Shorten URL of certain filetypes to just the filename?

Continuing the discussion from I can upload all kinds of files that aren't images:

Currently, when I upload a file to kinopio, if it’s a supported image type, the image gets rendered. Otherwise, it’s just the full URL. In this case, maybe we want to just show the filename. You asked me what filetypes we should do this for, and I wonder if it’s for all of them. Additionally, for more common filetypes, you could show a specific icon representing that filetype. Maybe that’s what you were asking for, but just wanted to clarify.

It’s kinda elegant on the one hand that a URL in a card is a URL. In other cases, if I paste a URL, I would definitely not want it to get shortened to just the filename. So it seems like the two cases we are talking about are URLs vs attachments/uploads.

So to bring it back, what if we treat kinopio uploads like this and only show the filename? Perhaps that’s what you already had in mind :slight_smile: And in that case, maybe we don’t need app-specific icons. Just show that it is an uploaded file and the filename (which includes the extension that indicates the filetype).

Another hack that we can do currently is to use the kinopio upload URL as a markdown link.

1 Like

I don kinda like the middle card solution with icon and name because the link coloring adds visual attention that might not be intended for a supplementary file. Also because you can use the icon to download still.

Instead of a bunch of custom icons though, it might be a lot easier and more readable to just use a grey text badge like this

Screen Shot 2021-04-20 at 11.47.23 AM,

maybe with a generic document icon next to the badge if needed?

1 Like

do or don’t? :slight_smile:

from context, it sounds like do. I agree, the link coloring and underline is a bit much. yeah, the grey text badge is nice – that’s what I was trying to accomplish with that rectangular glyph. Having both might be redundant.

1 Like

whoops, ya that’s a ‘do’ like

1 Like

oh looks like i’ll still need a list of non-media file types though,

off the top of my head:

txt, pdf, ppt, doc, pptx, docx, csv, xsl, xslx, rtf,

what else am I missing?

zip, tar, xml

1 Like

Shipped an update that truncates and highlights filenames (doing it all in a badge was worlds easier to implement and looks okay irl)

it’s a bit experimental , tested as much as I could locally - let me know if you see anything weird

2 Likes

updated with a little ‘file’ icon
Screen Shot 2021-04-21 at 9.11.52 AM

1 Like

Finding some quirks here.

image
image
image
image

  1. there’s something weird with wrong indexing around the string that is detected as a file. as you can see from the above examples
  2. The file detection is too aggressive? coolfile.txt probably shouldn’t be detected since it’s not going to link anywhere.
  3. the icon is a nice touch
1 Like

as you’re well-aware, nice consistency with the audio files too:

image

1 Like

fixed reported issues

a url with file extension – but without http/s – is no longer considered a file, which fixes 1 and 2 (protocol was being automatically prepended and breaking text replacement)

1 Like