开发者

How to get HTML files to find their dependencies' file paths using WebSVN?

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 开发者_如何学Cfile in WebSVN and be able to view the HTML file properly as I can with regular DAV SVN?


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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜