aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--zipstream.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/zipstream.php b/zipstream.php
index 14d728f..e0790b6 100644
--- a/zipstream.php
+++ b/zipstream.php
@@ -281,10 +281,9 @@ class ZipStream {
# Create and send zip header for this file.
#
function add_file_header($name, $opt, $meth, $crc, $zlen, $len) {
- # strip leading slash from file name
+ # strip leading slashes from file name
# (fixes bug in windows archive viewer)
- if ($name[0] == '/')
- $name = substr($name, 1);
+ $name = preg_replace('/^\\/+/', '', $name)
# calculate name length
$nlen = strlen($name);