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

OSOE-351: Adding some input validation #121

Merged
merged 1 commit into from
Dec 5, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Controllers/CrossTenantServicesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ await shellScope.UsingAsync(async scope =>
// error handling for missing content items here, or any authorization. It's up to you to add those :).
var contentItem = await contentManager.GetAsync(contentItemId);

// DisplayText is what you've already learned about in PersonPartHandler.
title = contentItem.DisplayText;
if (contentItem != null)
{
// DisplayText is what you've already learned about in PersonPartHandler.
title = contentItem.DisplayText;
}
});

return title;
Expand Down
2 changes: 2 additions & 0 deletions Controllers/FileManagementController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ public async Task<string> ReadFileFromMediaFolder()
[HttpPost, ActionName(nameof(UploadFileToMedia)), ValidateAntiForgeryToken]
public async Task<ActionResult> UploadFileToMediaPost(IFormFile file)
{
if (file == null) return BadRequest();

// You can use the Combine method to combine paths which is pretty much equivalent to the built-in method.
var mediaFilePath = _mediaFileStore.Combine(UploadedFileFolderRelativePath, file.FileName);

Expand Down