Browse Source

Fixed shortener not using correct url when generated.

pull/29/head
Teknikode 6 years ago
parent
commit
0aab15f446
  1. 1
      Teknik/App_Start/SubdomainRoute.cs
  2. 2
      Teknik/Areas/API/Controllers/APIv1Controller.cs
  3. 2
      Teknik/Areas/Shortener/Controllers/ShortenerController.cs

1
Teknik/App_Start/SubdomainRoute.cs

@ -81,6 +81,7 @@ namespace Teknik @@ -81,6 +81,7 @@ namespace Teknik
// Check if this route is valid for the current subdomain ('*' means any subdomain is valid)
if (Subdomains.Contains("*") || Subdomains.Contains(subdomain))
{
routeData.Values["sub"] = subdomain;
return routeData;
}
}

2
Teknik/Areas/API/Controllers/APIv1Controller.cs

@ -162,7 +162,7 @@ namespace Teknik.Areas.API.Controllers @@ -162,7 +162,7 @@ namespace Teknik.Areas.API.Controllers
db.ShortenedUrls.Add(newUrl);
db.SaveChanges();
string shortUrl = Url.SubRouteUrl(string.Empty, "Shortener.View", new { url = newUrl.ShortUrl });
string shortUrl = string.Format("http://{0}/{1}", Config.ShortenerConfig.ShortenerHost, newUrl.ShortUrl);
if (Config.DevEnvironment)
{
shortUrl = Url.SubRouteUrl("shortened", "Shortener.View", new { url = newUrl.ShortUrl });

2
Teknik/Areas/Shortener/Controllers/ShortenerController.cs

@ -56,7 +56,7 @@ namespace Teknik.Areas.Shortener.Controllers @@ -56,7 +56,7 @@ namespace Teknik.Areas.Shortener.Controllers
db.ShortenedUrls.Add(newUrl);
db.SaveChanges();
string shortUrl = Url.SubRouteUrl(string.Empty, "Shortener.View", new { url = newUrl.ShortUrl });
string shortUrl = string.Format("http://{0}/{1}", Config.ShortenerConfig.ShortenerHost, newUrl.ShortUrl);
if (Config.DevEnvironment)
{
shortUrl = Url.SubRouteUrl("shortened", "Shortener.View", new { url = newUrl.ShortUrl });

Loading…
Cancel
Save