From 0aab15f44671c0a457c1cd1c14348dffd2bb9a46 Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Wed, 24 Feb 2016 16:06:27 -0800 Subject: [PATCH] Fixed shortener not using correct url when generated. --- Teknik/App_Start/SubdomainRoute.cs | 1 + Teknik/Areas/API/Controllers/APIv1Controller.cs | 2 +- Teknik/Areas/Shortener/Controllers/ShortenerController.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Teknik/App_Start/SubdomainRoute.cs b/Teknik/App_Start/SubdomainRoute.cs index 348248d..75bc00c 100644 --- a/Teknik/App_Start/SubdomainRoute.cs +++ b/Teknik/App_Start/SubdomainRoute.cs @@ -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; } } diff --git a/Teknik/Areas/API/Controllers/APIv1Controller.cs b/Teknik/Areas/API/Controllers/APIv1Controller.cs index d1df9d5..1c62117 100644 --- a/Teknik/Areas/API/Controllers/APIv1Controller.cs +++ b/Teknik/Areas/API/Controllers/APIv1Controller.cs @@ -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 }); diff --git a/Teknik/Areas/Shortener/Controllers/ShortenerController.cs b/Teknik/Areas/Shortener/Controllers/ShortenerController.cs index 108d6b9..e458fd0 100644 --- a/Teknik/Areas/Shortener/Controllers/ShortenerController.cs +++ b/Teknik/Areas/Shortener/Controllers/ShortenerController.cs @@ -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 });