Properly removing start and ending slashes

Fixes: bug #1146690

Change-Id: I4258948f749128edeafb6ef3e64bda4ff35dbb58
Signed-off-by: Doug Hellmann <doug.hellmann@dreamhost.com>