diff --git a/CHANGELOG.md b/CHANGELOG.md index db9a0b48..266e09c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,10 +31,15 @@ and this project adheres to - Go 1.14 support. +### Fixed + +- Invalid filenames in the `mobileconfig` API responses ([#2835]). + [#2385]: https://github.com/AdguardTeam/AdGuardHome/issues/2385 [#2412]: https://github.com/AdguardTeam/AdGuardHome/issues/2412 [#2498]: https://github.com/AdguardTeam/AdGuardHome/issues/2498 [#2533]: https://github.com/AdguardTeam/AdGuardHome/issues/2533 +[#2835]: https://github.com/AdguardTeam/AdGuardHome/issues/2835 diff --git a/internal/home/mobileconfig.go b/internal/home/mobileconfig.go index 9ea3e7f5..beb50b22 100644 --- a/internal/home/mobileconfig.go +++ b/internal/home/mobileconfig.go @@ -152,6 +152,18 @@ func handleMobileConfig(w http.ResponseWriter, r *http.Request, dnsp string) { w.Header().Set("Content-Type", "application/xml") + const ( + dohContDisp = `attachment; filename=doh.mobileconfig` + dotContDisp = `attachment; filename=dot.mobileconfig` + ) + + contDisp := dohContDisp + if dnsp == dnsProtoTLS { + contDisp = dotContDisp + } + + w.Header().Set("Content-Disposition", contDisp) + _, _ = w.Write(mobileconfig) }