Skip to content

Instantly share code, notes, and snippets.

Created June 24, 2014 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/296ff950545c7c66cff2 to your computer and use it in GitHub Desktop.
Save anonymous/296ff950545c7c66cff2 to your computer and use it in GitHub Desktop.
../base_url_fix.patch
diff --git a/portdb/portdb/index.php b/portdb/portdb/index.php
index 62a4cd3..9448e84 100755
--- a/portdb/portdb/index.php
+++ b/portdb/portdb/index.php
@@ -103,16 +103,17 @@ class Port
function filesToXML() {
$xml = "";
if ($this->repo->type == "httpup") {
- $base_url = "{$this->repo->url}/";
+ $base_url = "{$this->repo->url}";
}
else {
$base_url = localrepo($this->repo->name);
}
if ($base_url != "") {
+ $base_url = chop($base_url, "/");
$xml = "<files>";
- $xml .= "<pkgfile>{$base_url}{$this->name}/Pkgfile</pkgfile>";
- $xml .= "<footprint>{$base_url}{$this->name}/.footprint</footprint>";
- $xml .= "<md5sum>{$base_url}{$this->name}/.md5sum</md5sum>";
+ $xml .= "<pkgfile>{$base_url}/{$this->name}/Pkgfile</pkgfile>";
+ $xml .= "<footprint>{$base_url}/{$this->name}/.footprint</footprint>";
+ $xml .= "<md5sum>{$base_url}/{$this->name}/.md5sum</md5sum>";
$xml .= "</files>";
}
return $xml;
@@ -121,15 +122,16 @@ class Port
function filesToHTML() {
$html = "";
if ($this->repo->type == "httpup") {
- $base_url = "{$this->repo->url}/";
+ $base_url = "{$this->repo->url}";
}
else {
$base_url = localrepo($this->repo->name);
}
if ($base_url != "") {
- $html = "<a href=\"{$base_url}{$this->name}/Pkgfile\">P</a> ";
- $html .= "<a href=\"{$base_url}{$this->name}/.footprint\">F</a> ";
- $html .= "<a href=\"{$base_url}{$this->name}/.md5sum\">M</a>";
+ $base_url = chop($base_url, "/");
+ $html = "<a href=\"{$base_url}/{$this->name}/Pkgfile\">P</a> ";
+ $html .= "<a href=\"{$base_url}/{$this->name}/.footprint\">F</a> ";
+ $html .= "<a href=\"{$base_url}/{$this->name}/.md5sum\">M</a>";
}
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment