when trying to open files in repository,but downloading start
I'd like view my python source code in the repository of redmine since it's convenient and the soucecode are very clean and neat in that view. The problem is that sometimes some python source will not be opened but can only be downloaded when I click on it . But some python source do can be viewed online. The file names all end with ".py". Why ?
I'm using Subversion. Is it related to subversion or redmine ?
Many thanks for your help.
RE: when trying to open files in repository,but downloading start - Added by Victor Gavro about 10 years ago
simple workaround for this - just add some ascii data.
Attaching script to determine if ruby considers file as binary and know how many ascii data you need more :-)
binary.rb (423 Bytes)
RE: when trying to open files in repository,but downloading start - Added by Jeremy Coatelen over 6 years ago
More than three years later, I just had the same problem.Victor proposes to add some ascii data but, sadly, I cannot do this. So, I had a look into redmine source code ... here is the tiny trick I did to make redmine able to view given extensions as plain texts :
- Set mime-type to
text/plainin your repository properties
- Let REDMINE_DIR be the path to your redmine install root directory, then edit
REDMINE_DIR/lib/redmine/mime_type.rbwith your favorite text editor.
- At the top of the module, locate MIME_TYPES array definition.
- Locate the list of extensions for 'text/plain' and add your extensions at the end of it.
'text/plain' => 'txt,tpl,properties,patch,diff,ini,readme,install,upgrade', becomes : 'text/plain' => 'txt,tpl,properties,patch,diff,ini,readme,install,upgrade,acf,acm,acq,acl,acr,act',
I added the list
acf,acm,acq,acl,acr,actbut you may want to add
This is NOT a permanent fix. The next upgrade may erase it so that you will need to add your extensions again. I'm still looking for a permanent solution ... I would like redmine to let an administrator add the new extensions via the global repository settings.