FIX: Include subfolder base_path in web app manifest shortcuts (#10878)

FIX: Include subfolder base_path in web app manifest shortcuts (#10878)

diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb
index 33d19f2..594fcab 100644
--- a/app/controllers/metadata_controller.rb
+++ b/app/controllers/metadata_controller.rb
@@ -45,13 +45,13 @@ class MetadataController < ApplicationController
       name: SiteSetting.title,
       short_name: SiteSetting.short_title.presence || SiteSetting.title.truncate(12, separator: ' ', omission: ''),
       display: display,
-      start_url: Discourse.base_uri.present? ? "#{Discourse.base_uri}/" : '.',
+      start_url: Discourse.base_path.present? ? "#{Discourse.base_path}/" : '.',
       background_color: "##{ColorScheme.hex_for_name('secondary', scheme_id)}",
       theme_color: "##{ColorScheme.hex_for_name('header_background', scheme_id)}",
       icons: [
       ],
       share_target: {
-        action: "/new-topic",
+        action: "#{Discourse.base_path}/new-topic",
         method: "GET",
         enctype: "application/x-www-form-urlencoded",
         params: {
@@ -63,7 +63,7 @@ class MetadataController < ApplicationController
         {
           name: I18n.t('js.topic.create_long'),
           short_name: I18n.t('js.topic.create'),
-          url: "/new-topic",
+          url: "#{Discourse.base_path}/new-topic",
           icons: [
             {
               src: "#{icon_url_base}/plus.svg",
@@ -75,7 +75,7 @@ class MetadataController < ApplicationController
         {
           name: I18n.t('js.user.messages.inbox'),
           short_name: I18n.t('js.user.messages.inbox'),
-          url: "/my/messages",
+          url: "#{Discourse.base_path}/my/messages",
           icons: [
             {
               src: "#{icon_url_base}/envelope.svg",
@@ -87,7 +87,7 @@ class MetadataController < ApplicationController
         {
           name: I18n.t('js.user.bookmarks'),
           short_name: I18n.t('js.user.bookmarks'),
-          url: "/my/bookmarks",
+          url: "#{Discourse.base_path}/my/bookmarks",
           icons: [
             {
               src: "#{icon_url_base}/bookmark.svg",
@@ -99,7 +99,7 @@ class MetadataController < ApplicationController
         {
           name: I18n.t('js.filters.top.title'),
           short_name: I18n.t('js.filters.top.title'),
-          url: "/top",
+          url: "#{Discourse.base_path}/top",
           icons: [
             {
               src: "#{icon_url_base}/signal.svg",

GitHub sha: 5e3130ac

This commit appears in #10878 which was approved by danielwaterworth and danielwaterworth. It was merged by davidtaylorhq.