mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
MM-13923 Fixing pulling from incorect cache. (#10216)
* Fixing pulling from incorect cache. * Adding caching test.
This commit is contained in:
committed by
GitHub
parent
0f35c4b24d
commit
4e0840969b
@@ -489,7 +489,7 @@ func getRedirectLocation(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if location, ok := openGraphDataCache.Get(url); ok {
|
||||
if location, ok := redirectLocationDataCache.Get(url); ok {
|
||||
m["location"] = location.(string)
|
||||
w.Write([]byte(model.MapToJson(m)))
|
||||
return
|
||||
|
||||
@@ -771,6 +771,11 @@ func TestRedirectLocation(t *testing.T) {
|
||||
CheckNoError(t, resp)
|
||||
assert.Equal(t, expected, actual)
|
||||
|
||||
// Check cached value
|
||||
actual, resp = th.SystemAdminClient.GetRedirectLocation(mockBitlyLink, "")
|
||||
CheckNoError(t, resp)
|
||||
assert.Equal(t, expected, actual)
|
||||
|
||||
*th.App.Config().ServiceSettings.EnableLinkPreviews = false
|
||||
actual, resp = th.SystemAdminClient.GetRedirectLocation("https://mattermost.com/", "")
|
||||
CheckNoError(t, resp)
|
||||
|
||||
Reference in New Issue
Block a user