On Sat, May 23, 2020 at 7:17 PM Craig Russell <apache....@gmail.com> wrote:
>
> > On May 22, 2020, at 4:29 PM, sebb <seb...@gmail.com> wrote:
> >
> > On Fri, 22 May 2020 at 20:12, Craig Russell <apache....@gmail.com> wrote:
> >>
> >> Hi Sebb,
> >>
> >> Yes, changing the svn:mime-type to text/pain makes Safari think that it's 
> >> ok to display.
> >>
> >> So I will change the mime-type for all such .eml files once I've gotten my 
> >> round tuit.
> >>
> >> Still have the problem with the .rtf that Safari insists on downloading. 
> >> The only thing I can think of is to edit the file, change to plain text, 
> >> and save as text/plain mime-type.
> >
> > Why is that a problem?
>
> When I look at a person using whimsy/www/committer and there are form links, 
> it's nice to simply command-click on the file link and bring up the linked 
> file in a browser tab. When done looking at it, I just close the tab. This 
> will be needed to process the emeritus requests once the new buttons are 
> added.
>
> If the form link is a .rtf file, command-click opens a tab and either 
> displays a message in the tab saying "Ok to download file?" or has a blank 
> tab and the downloader indicates that a file has been downloaded. Then, the 
> user has to click on the downloader button, find the downloaded .rtf file, 
> click on it, which brings up the finder, double click on the file to open it 
> in the user's selected ".rtf" opener, and go off to that application to read 
> the file. Whole lotta nothing just to look at an rtf file, and then get back 
> to Safari to continue.

Just a reminder, we have the entire resources of a web server at our disposal.

So, thinking outside of the box, and given that we are talking about
the roster tool here, a sketch.

Add the following to the bottom of whimsy/www/roster/main.rb:

get %r{/documents/(.*)} do |document|
  base = "https://svn.apache.org/repos/private/documents";
  auth = "--username #{env.user} --password #{env.password}"
  content_type 'text/plain;charset=utf8'
  `svn cat #{auth} #{base}/#{document}`
end

With that in place, you should be able to fetch
http://whimsy.local/roster/documents/README.txt

There appears to be a utility to convert RTF to HTML available for Ubuntu:

http://manpages.ubuntu.com/manpages/bionic/man1/unrtf.1.html

It looks to be available via brew too.

Putting the pieces together, you could have a URL that fetches the RTF
from SVN, uses unrtf to convert it to HTML, and then serves the result
with the text/html mime type.

Once that is in place, you could change the committer page to link to
this URL instead.  Either unconditionally, or conditionally based on
the file extension.

- Sam Ruby





> > What should Safari do?
>
> Open the file in a browser tab or window.
>
> > What do other browsers do?
>
> Chrome does the same as Safari but with somewhat different dialog. Same whole 
> lotta clicks just to view the file in a different application.
>
> Firefox does the same as Safari but with somewhat different dialog. Same 
> whole lotta clicks just to view the file in a different application.
>
> Craig
> >
> >> Craig
> >>
> >>> On May 21, 2020, at 4:53 AM, sebb <seb...@gmail.com> wrote:
> >>>
> >>> On Wed, 20 May 2020 at 15:48, Craig Russell <apache....@gmail.com> wrote:
> >>>>
> >>>> Hi Sebb,
> >>>>
> >>>> Thanks for that. I'm trying to get Safari to display the Emeritus file 
> >>>> for users with .rtf and .eml suffixes and Safari wants to download them 
> >>>> instead of viewing them. For other file types, changing the 
> >>>> svn:mime-type on the file has fixed it (but I have no idea how Safari 
> >>>> gets the mime-type).
> >>>>
> >>>> As an example, user ids scolebourne and skitching do not display the 
> >>>> Emeritus file from the committer display. (These ids are publicly known 
> >>>> so no security issue).
> >>>
> >>> If you are referring to the 'Emeritus' link on the Whimsy committer
> >>> page, then this is a URL of the form https://svn.apache.org/repos/...
> >>> This is not served by Whimsy, but by the svn.apache.org server.
> >>> The eml file for skitching is served with the content-type
> >>> message/rfc822; this appears to be taken from the SVN mime-type
> >>> property.
> >>> I have temporarily changed the mime-type to text/plain, and Safari now
> >>> displays the file rather than downloading it.
> >>>
> >>> Whether it makes sense to change the mime-type for all .eml files, I 
> >>> don't know.
> >>> I suspect not, as some people may prefer to use a dedicated handler.
> >>>
> >>> The alternative is to configure Safari to treat .eml files as text/plain.
> >>> Whether that is possible, I have no idea.
> >>>
> >>>
> >>>> Thanks,
> >>>> Craig
> >>>>
> >>>>> On May 20, 2020, at 7:20 AM, sebb <seb...@gmail.com> wrote:
> >>>>>
> >>>>> On Tue, 19 May 2020 at 20:54, Craig Russell <apache....@gmail.com> 
> >>>>> wrote:
> >>>>>>
> >>>>>> I've seen a number of emeritus files with the wrong svn:mime-type. 
> >>>>>> They are fixed now (I think) but does the new secretary workbench set 
> >>>>>> the mime-type for new documents received?
> >>>>>
> >>>>> Whether the mime-type is set depends on the file type.
> >>>>>
> >>>>>> There are a number of places where the mime-type could be set. Can 
> >>>>>> someone take a look?
> >>>>>>
> >>>>>
> >>>>> The subversion client uses the following config files:
> >>>>>
> >>>>> /etc/subversion/config
> >>>>> which can be overridden by
> >>>>> ~/.subversion/config
> >>>>>
> >>>>> AFAICT /etc/subversion/config is set up by the Puppet file:
> >>>>>
> >>>>> modules/subversionclient/files/config
> >>>>>
> >>>>> which contains the following mime types
> >>>>> *.doc = svn:mime-type=application/msword
> >>>>> *.gif = svn:mime-type=image/gif
> >>>>> *.gz = svn:mime-type=application/x-gzip
> >>>>> *.ico = svn:mime-type=image/x-icon
> >>>>> *.jpg = svn:mime-type=image/jpeg
> >>>>> *.pdf = svn:mime-type=application/pdf
> >>>>> *.png = svn:mime-type=image/png
> >>>>> *.tar = svn:mime-type=application/octet-stream
> >>>>> *.tgz = svn:mime-type=application/octet-stream
> >>>>> *.tif = svn:mime-type=image/tiff
> >>>>> *.tiff = svn:mime-type=image/tiff
> >>>>>
> >>>>> Additional types that could perhaps be added to the list:
> >>>>> *.asc = text/plain
> >>>>> *.eml = text/plain
> >>>>> *.gpg = application/octet-stream
> >>>>> *.rtf = application/rtf
> >>>>> *.sig = application/octet-stream
> >>>>>
> >>>>>> Thanks,
> >>>>>> Craig
> >>>>>>
> >>>>>> Craig L Russell
> >>>>>> c...@apache.org
> >>>>>>
> >>>>
> >>>> Craig L Russell
> >>>> c...@apache.org
> >>>>
> >>
> >> Craig L Russell
> >> c...@apache.org
> >>
>
> Craig L Russell
> c...@apache.org
>

Reply via email to