Skip to content

Commit

Permalink
Merge pull request sakaiproject#59 from buckett/SAK-28994
Browse files Browse the repository at this point in the history
SAK-28994 No NPE when anonymous access WebDAV page
  • Loading branch information
ottenhoff committed Jan 20, 2015
2 parents 38a9446 + 7df1a49 commit 3d104b5
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5506,7 +5506,12 @@ else if(parts.length >= 3)
context.put("server_url", ServerConfigurationService.getServerUrl());
context.put("site_id", ToolManager.getCurrentPlacement().getContext());
context.put("site_title", state.getAttribute(STATE_SITE_TITLE));
context.put("user_id", UserDirectoryService.getCurrentUser().getEid().matches(".*(;|/|\\?|:|@|&|=|\\+).*")?UserDirectoryService.getCurrentUser().getId():UserDirectoryService.getCurrentUser().getEid());

String eid = UserDirectoryService.getCurrentUser().getEid();
// Check the user is logged in and doesn't have characters that cause problems in WebDAV urls.
String userUrlId = (eid != null && eid.matches(".*(;|/|\\?|:|@|&|=|\\+).*"))
? UserDirectoryService.getCurrentUser().getId() : eid;
context.put("user_id", userUrlId);

if (ContentHostingService.isShortRefs())
{
Expand Down

0 comments on commit 3d104b5

Please sign in to comment.