Disallow history/blame for non-file blobs
Disallow history/blame for non-file blobs

--- a/include/controller/Controller_Blob.class.php
+++ b/include/controller/Controller_Blob.class.php
@@ -168,7 +168,7 @@
 		}
 
 		$blob = $this->project->GetBlob($this->params['hash']);
-		if ($this->params['file'])
+		if (!empty($this->params['file']))
 			$blob->SetPath($this->params['file']);
 		$blob->SetCommit($commit);
 		$this->tpl->assign('blob', $blob);

--- a/templates/blob.tpl
+++ b/templates/blob.tpl
@@ -16,8 +16,10 @@
    {else}
      {t}HEAD{/t}
    {/if}
+   {if $blob->GetPath()}
     | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=history&amp;h={$commit->GetHash()}&amp;f={$blob->GetPath()}">{t}history{/t}</a>
    {if !$datatag} | <a href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=blame&amp;h={$blob->GetHash()}&amp;f={$blob->GetPath()}&amp;hb={$commit->GetHash()}" id="blameLink">{t}blame{/t}</a>{/if}
+   {/if}
    <br />
  </div>
 

comments