Change giphy short url, was gph.is but was using gph.se

This commit is contained in:
Shivek Khurana 2021-02-03 19:28:12 +05:30 committed by Andrea Maria Piana
parent 4b5dbc3d52
commit 757dbcd98e
2 changed files with 5 additions and 5 deletions

View File

@ -69,8 +69,8 @@ func LinkPreviewWhitelist() []Site {
ImageSite: true, ImageSite: true,
}, },
Site{ Site{
Title: "GIPHY GIFs Short URLS", Title: "GIPHY GIFs shortener",
Address: "gph.se", Address: "gph.is",
ImageSite: true, ImageSite: true,
}, },
Site{ Site{
@ -176,7 +176,7 @@ func GetGiphyPreviewData(link string) (previewData LinkPreviewData, err error) {
return previewData, nil return previewData, nil
} }
// Giphy has a shortener service called gph.se, the oembed service doesn't work with shortened urls, // Giphy has a shortener service called gph.is, the oembed service doesn't work with shortened urls,
// so we need to fetch the long url first // so we need to fetch the long url first
func GetGiphyLongURL(shortURL string) (longURL string, err error) { func GetGiphyLongURL(shortURL string) (longURL string, err error) {
// nolint: gosec // nolint: gosec
@ -250,7 +250,7 @@ func GetLinkPreviewData(link string) (previewData LinkPreviewData, err error) {
return GetGithubPreviewData(link) return GetGithubPreviewData(link)
case "giphy.com": case "giphy.com":
return GetGiphyPreviewData(link) return GetGiphyPreviewData(link)
case "gph.se": case "gph.is":
return GetGiphyShortURLPreviewData(link) return GetGiphyShortURLPreviewData(link)
case "tenor.com": case "tenor.com":
return GetTenorPreviewData(link) return GetTenorPreviewData(link)

View File

@ -74,7 +74,7 @@ func TestGetGiphyLongURL(t *testing.T) {
_, err := GetGiphyLongURL("http://this-giphy-site-doesn-not-exist.se/bogus-url") _, err := GetGiphyLongURL("http://this-giphy-site-doesn-not-exist.se/bogus-url")
require.Error(t, err) require.Error(t, err)
_, err = GetGiphyLongURL("http://gph.se/bogus-url-but-correct-domain") _, err = GetGiphyLongURL("http://gph.is/bogus-url-but-correct-domain")
require.Error(t, err) require.Error(t, err)
} }