mirror of
https://github.com/discourse/discourse.git
synced 2025-03-14 10:33:43 +00:00
DEV: Add support for .well-known/apple-app-site-association
(#31798)
We already support `/apple-app-site-association` at the root. Apple also accepts `.well-known/apple-app-site-association` as a valid path so this adds that as well, just in case.
This commit is contained in:
@ -1574,7 +1574,10 @@ Discourse::Application.routes.draw do
|
||||
get "manifest.webmanifest" => "metadata#manifest", :as => :manifest
|
||||
get "manifest.json" => "metadata#manifest"
|
||||
get ".well-known/assetlinks.json" => "metadata#app_association_android"
|
||||
# Apple accepts either of these paths for the apple-app-site-association file
|
||||
# Might as well support both
|
||||
get "apple-app-site-association" => "metadata#app_association_ios", :format => false
|
||||
get ".well-known/apple-app-site-association" => "metadata#app_association_ios", :format => false
|
||||
get "opensearch" => "metadata#opensearch", :constraints => { format: :xml }
|
||||
|
||||
scope "/tag/:tag_id" do
|
||||
|
@ -164,6 +164,9 @@ RSpec.describe MetadataController do
|
||||
it "returns 404 by default" do
|
||||
get "/apple-app-site-association"
|
||||
expect(response.status).to eq(404)
|
||||
|
||||
get "/.well-known/apple-app-site-association"
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
||||
it "returns the right output" do
|
||||
@ -181,6 +184,13 @@ RSpec.describe MetadataController do
|
||||
expect(response.media_type).to eq("application/json")
|
||||
expect(response.headers["Cache-Control"]).to eq("max-age=60, private")
|
||||
|
||||
get "/.well-known/apple-app-site-association"
|
||||
|
||||
expect(response.status).to eq(200)
|
||||
expect(response.body).to include("applinks")
|
||||
expect(response.media_type).to eq("application/json")
|
||||
expect(response.headers["Cache-Control"]).to eq("max-age=60, private")
|
||||
|
||||
get "/apple-app-site-association.json"
|
||||
expect(response.status).to eq(404)
|
||||
end
|
||||
|
Reference in New Issue
Block a user