From owner-freebsd-cvsweb@FreeBSD.ORG Wed May 28 01:19:50 2003 Return-Path: Delivered-To: freebsd-cvsweb@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B16137B401 for ; Wed, 28 May 2003 01:19:50 -0700 (PDT) Received: from mf2.bredband.net (mf2.bredband.net [195.54.106.37]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16EA843F3F for ; Wed, 28 May 2003 01:19:49 -0700 (PDT) (envelope-from daniel.wallner@bredband.net) Received: from mf2.bredband.net ([195.54.106.39]) by mf2.bredband.net with SMTP id <20030528081945.DVGY29707.mf2@mf2.bredband.net> for ; Wed, 28 May 2003 10:19:45 +0200 From: To: freebsd-cvsweb@freebsd.org Date: Wed, 28 May 2003 10:19:45 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-Id: <20030528081945.DVGY29707.mf2@mf2.bredband.net> Subject: cvsweb and binary files X-BeenThere: freebsd-cvsweb@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS Web maintenance mailing list [restricted posting] List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 08:19:50 -0000 We are using cvsweb to browse our cvs repository where we have both text based design files and binary documents. For text files cvsweb behaves acceptable but for binary documents the default behavior is a bit weird. This is mainly due to that the default mime type is text for nearly all files, while this is fine for Internet Explorer that seems to ignore the type, Netscape just displays garbage. But there are also some bugs related to this. There is a simple way to make the default mime types correct, either comment out the "*" line in %MTYPES or add the types you need. Since the gain of the "*" is negligible, I don't think it should be in the default configuration due to all the trouble it causes. However, if you remove the "*" line from %MTYPES it still doesn't solve the problems entirely. These problems exists in both version 1.149 and 1.119.2.8, although the line numbers refer to 1.149. 1: At line 896 mimetype and defaultViewable are not defined correctly, adding lines: 895a896,897 > $mimetype = &getMimeTypeFromSuffix($file); > $defaultViewable = $allow_markup && viewable($mimetype); fixes the problem although a better solution would be to remove these ugly global variables. 2: In getMimeTypeFromSuffix the $mimetype variable can sometimes be uninitialized, adding the line: 1494a1497 > $mimetype = ""; fixes that problem. Although if the mime_types variable doesn't point to a valid file $mimetype can still be used uninitialized. There should be a check for this. Adding the line: 1509c1512 < if (!($mimetype =~ /\S\/\S/)) { --- > if (!$mimetype || !($mimetype =~ /\S\/\S/)) { removes the error message but it would be better to add a check if the file exists and a proper error message. 3: In cvswebMarkup the code for viewing PDFs is wrong. Changing the lines: 1896c1899 < printf '
', hrefquote("$url$barequery"); --- > printf '
', hrefquote("$url$barequery"); makes it possible to view PDFs in something else than thumbnail size. 4: Although this is not a bug, printLog behaves a bit strange when the $mimetype variable is set correctly. When $mimetype incorrectly is set to text for nearly all files the download link will always be displayed separately and the revision number will always be the view link. If $mimetype is set correctly the behaviour will change depending on if cvsweb thinks that it is possible to view the file or not. This can be confusing enough for some people to wonder how to download files when the download link isn't displayed verbatim. I think it would be better if the download and view links were always displayed separately. Commenting or removing these lines fixes the problem: 2582c2585 < if ($defaultViewable) { --- > # if ($defaultViewable) { 2586c2589 < } --- > # } 2594c2597 < if (!$defaultViewable) { --- > # if (!$defaultViewable) { 2598c2601 < } The download link itself can also cause problems, and it is different than the link in the revision number. The revision number link always work, the download link doesn't. Netscape gets very confused when the mime type is set to something it doesn't recognize. So it would be better if the download link was changed to the same as the revision number link. Regards, Daniel Wallner