Skip to content

Commit

Permalink
Don't check user permissions unless there's a user
Browse files Browse the repository at this point in the history
Fixes #4355
  • Loading branch information
bdukes committed Dec 11, 2020
1 parent 27c6974 commit f97a115
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ public void HandleImageRequest(HttpContextBase context, Func<NameValueCollection

string cacheId = this.GetUniqueIDString(context, uniqueIdStringSeed);

var userId = -1;
var cacheCleared = false;
var profilepic = context.Request.QueryString["mode"];
int userId = -1;
if ("profilepic".Equals(profilepic, StringComparison.InvariantCultureIgnoreCase))
var isProfilePic = "profilepic".Equals(context.Request.QueryString["mode"], StringComparison.InvariantCultureIgnoreCase);
if (isProfilePic)
{
if (int.TryParse(context.Request.QueryString["userId"], out userId))
{
Expand Down Expand Up @@ -260,7 +260,7 @@ public void HandleImageRequest(HttpContextBase context, Func<NameValueCollection
// Handle Server cache
if (this.EnableServerCache)
{
if (!this.IsPicVisibleToCurrentUser(userId))
if (isProfilePic && !this.IsPicVisibleToCurrentUser(userId))
{
string message = "Not allowed to see profile picture";

Expand Down

0 comments on commit f97a115

Please sign in to comment.