Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > Safari apending .txt file extensions - how to prevent?

Safari apending .txt file extensions - how to prevent?
Thread Tools
Dedicated MacNNer
Join Date: Dec 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 24, 2007, 01:56 AM
 
I am downloading files with safari and rather annoyingly, safari insists on adding a .txt extention to each one - even though the files already have an extension.

Even if they didn't it should be my choice. How do I stop Safari renaming my files? I breaking things by trying to be helpful was a Windows trait - next thing we'll have speech bubbles every 2 minutess
iBook G3 366mhz as a web server:
http://kieren.demon.co.uk/wordpress/
     
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Jun 24, 2007, 08:20 AM
 
That's not normal behavior for Safari.
     
JKT
Professional Poster
Join Date: Jan 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 24, 2007, 08:31 AM
 
Is this all downloads from multiple different sites or just downloads from one site in particular? If the latter, this is far more likely to be a problem with the set up of the server that you are downloading the files from (the server more than likely has incorrectly assigned mime types). In other words, Safari is being told the files are .txt files when they are not and is therefore doing the "right" thing by assigning the .txt extension to them.
     
Dedicated MacNNer
Join Date: Dec 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 24, 2007, 09:05 AM
 
Firefox and Opera can download from this site without appending txt to the files.

Safari shouldn't append anything regardless of whether it recognises the mime type or not. It's extremely annoying and if you go to the roots of os X - everything is a file - even directories. os X shouldn't 'need' file extensions so why Safari insists on adding txt to certain files is beyond me.

btw, this is with Safari 2 and now the latest beta 3.

files are file.vce format - vce is an exam simulation file
iBook G3 366mhz as a web server:
http://kieren.demon.co.uk/wordpress/
     
JKT
Professional Poster
Join Date: Jan 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 24, 2007, 09:47 AM
 
a) Report it to Apple using the Report Bugs... option in the Safari menu.
b) Just because Firefox and Opera don't do this doesn't mean that the source of the issue isn't on the server (I pretty much guarantee you that it is because the mime types haven't been assigned correctly, so you should also inform the site developers as well). What is happening is that Safari is not "failing" as gracefully as Firefox or Opera.

FWIW, if you have a lot of downloads already where this has happened to you and you need to rename them, you can use Automator to create a Finder action to batch rename the files automatically (i.e. change the .vce.txt extension to .vce).
     
Dedicated MacNNer
Join Date: Dec 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 24, 2007, 03:32 PM
 
I posted a bug

I have to say that was pretty painless. If only bug reporting was always so easy. (I also use Linux and bug reporting for Gnome et al is mission impossible).

I might try the automator thing. This is my first month with a mac after a few years away so I'm not familiar with some of the new toys.
Thanks for your help
iBook G3 366mhz as a web server:
http://kieren.demon.co.uk/wordpress/
     
JKT
Professional Poster
Join Date: Jan 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 25, 2007, 01:55 AM
 
FWIW, here's the Automator action you will need to save as a Finder action:



If you want to be safer, include a Finder Copy action to duplicate the files before renamng them first.
     
Grizzled Veteran
Join Date: Apr 2004
Location: Nagoya, Japan • 日本 名古屋市
Status: Offline
Reply With Quote
Jun 25, 2007, 08:41 AM
 
As JKT notes, it's almost certainly because the server is mis-configured and telling Safari the files contain text data. And since there's no .txt extension, Safari is helpfully adding one.

(I agree, though, that since OS X doesn't rely on file extensions very often, we might be better off without them.)
     
Dedicated MacNNer
Join Date: Dec 2002
Location: London, UK
Status: Offline
Reply With Quote
Jun 26, 2007, 04:06 PM
 
Thanks JKT - that picture paints a thousand words and certainly makes Automator look easy

As for the server being messed up, I don't understand how that would work? I run Apache server and don't recall having to set anything for mime types other than perhaps the 16x16 icons if one enters directory view.
iBook G3 366mhz as a web server:
http://kieren.demon.co.uk/wordpress/
     
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Jun 26, 2007, 04:52 PM
 
AFAIK the Apache server software comes with a preset of extension->MIME-type assignments. If a file with an unknown extension (like .dmg) is served with the MIME-type text as a fallback, Safari adds a .txt extension. This behavior is arguably correct. The server tells Safari it is serving a text-file, and a text file needs a .txt extension on Mac to be opened with a text editor. So Safari adds one. Other browsers ignore the server, which is a short term benefit for the user, but in the long run a) makes the server admin not notice the mistake and b) prevents the server admin to use this feature whenever he intentionally wants to (as opposed to unintentionally doesn't care as usually).

Anyway, to fix this you can create a file .htaccess to the respective folder and correctly define the missing MIME-types by adding AddType application/octet-stream .dmg or AddType application/x-stuffit .sit and AddType application/x-stuffit .sitx etc.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:29 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2