views:

5

answers:

1

I set up DAV SVN recently with svn:mime-type set to "text/html" on my HTML files, which allows me to see the HTML file rendered normally in the browser, instead of plain text.

However, I switched to WebSVN so I could get syntax-highlighting on my code files, and now the HTML files are not able to locate their dependencies - js, css, etc. the files are not found by the HTML file.

Is there a way to open an HTML file in WebSVN and be able to view the HTML file properly as I can with regular DAV SVN?

A: 

For now, I added a redirection in WebSVN that redirects anything with mime-type "text/html" to the DAV SVN module.

The root of my server plus "/svn/", over HTTP protocol, is where my DAV SVN module points.

The root of my server plus "/websvn" is where WebSVN resides.

In the WebSVN file "filedetails.php", I added this code:

// If a MIME type is associated with the file, deliver with Content-Type header.
if (!empty($mimeType) && $rep->hasReadAccess($path, false)) {
    // DAN ADDED THIS -----------\
    if ($mimeType == 'text/html') {
        $dav_url = 'http://' . $_SERVER['SERVER_NAME'] . '/svn/' . $repname . $path;
        header("Location: $dav_url");
        exit;
    }
    //---------------------------/

    $base = basename($path);
    header('Content-Type: '.$mimeType);
    //header('Content-Length: '.$size);
    header('Content-Disposition: inline; filename='.urlencode($base));
    $svnrep->getFileContents($path, '', $rev, $peg);

    exit;
}
liutenantdan