Skip to content

Commit

Permalink
webdav: avoid NPE if client fails to send a User-Agent header
Browse files Browse the repository at this point in the history
Motivation:

Not all user-agents send a User-Agent header in their requests, yet
dCache webdav door fails with a NPE if not.  Duplicity is apparently
one such client.

Modification:

Update code to check if user-agent is the OwnCloud sync-client to be
robust against a client not sending the header.

Result:

No more NPEs.

Target: master
Request: 2.16
Request: 2.15
Patch: https://rb.dcache.org/r/9444/
Acked-by: Gerd Behrmann
Ticket: http://rt.dcache.org/Ticket/Display.html?id=8998
  • Loading branch information
paulmillar committed Jun 21, 2016
1 parent 7619008 commit 5370f74
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -33,6 +33,6 @@ public static boolean isSyncClient(HttpServletRequest request)
{
String userAgent = request.getHeader(HttpHeader.USER_AGENT.toString());

return userAgent.contains(OWNCLOUD_USERAGENT);
return userAgent != null && userAgent.contains(OWNCLOUD_USERAGENT);
}
}

0 comments on commit 5370f74

Please sign in to comment.