Skip to content

Commit

Permalink
Update file upload validation (#3854)
Browse files Browse the repository at this point in the history
  • Loading branch information
daguiler authored Jun 25, 2020
1 parent 0b1c037 commit 402fd83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,12 @@ private static FileUploadDto UploadFile(
extensionList = filter.Split(',').Select(i => i.Trim()).ToList();
}

var validateParams = new List<object> { extensionList, portalId, userInfo.UserID };
var validateParams = new List<object> { extensionList, userInfo.UserID };
if (!userInfo.IsSuperUser)
{
validateParams.Add(portalId);
}

if (!ValidationUtils.ValidationCodeMatched(validateParams, validationCode))
{
throw new InvalidOperationException("Bad Request");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,11 @@ public string ValidationCode
var parameters = new List<object>() { this.Extensions };
if (portalSettings != null)
{
parameters.Add(portalSettings.PortalId);
parameters.Add(portalSettings.UserInfo.UserID);
if (!portalSettings.UserInfo.IsSuperUser)
{
parameters.Add(portalSettings.PortalId);
}
}

return ValidationUtils.ComputeValidationCode(parameters);
Expand Down

0 comments on commit 402fd83

Please sign in to comment.