Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update file upload validation #3854

Merged
merged 1 commit into from Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -495,7 +495,12 @@ private static bool IsImage(string fileName)
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
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