Is it still necessary to use _ while naming files? - eviltoast

Edit: Thank you guys for your insightful answers!

  • helpimnotdrowning@lemmy.sdf.org
    link
    fedilink
    arrow-up
    20
    ·
    1 year ago

    TLDR; No

    It hasn’t been necessary in a long time, unless you’re a developer who frequently needs to type in filenames in everywhere (since the command line needs extra protection against spaces and other symbols)

    The OS (Windows, Mac, Android, etc) handles thar all for you so you don’t have to worry about it (unless you happen to use a badly-written program that doesn’t understand spaces, but this is super rare to begin with, and more protected against as time goes on)

    • jsveiga@sh.itjust.works
      link
      fedilink
      arrow-up
      7
      ·
      1 year ago

      Even non-developers may hate spaces in filenames, when links to the file you send in a message don’t work because clicking on them uses only up to before the first space.

    • Can-Utility@beehaw.org
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      I maintain a number of Drupal websites as part of my job. Our stakeholders have varying degrees of familiarity with the ins and outs of computing.

      A few months ago I got a ticket from one of our stakeholders. Apparently PDF files were broken across large swathes of their site. What happened was Red Hat pushed through an update to apache that closed some security loopholes. As an unexpected side effect, it also meant that any files being served from Drupal’s private file system would break if the files contained spaces in the names. No rewrite rules seemed to fix the issue; we ended up having to go into the rendered HTML and replace all the spaces in the links with ‘+’ signs. They are now told to make sure future files have underscores instead of spaces in the filename.

      So yes, in some cases you still need to use _ (or some sort of non-space character) in file names, even today.