Got questions, comments, patches, etc.?
Contact Jason Woofenden
gitweb
/
wfpl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
upload.php cleanup: really don't make dot files
[wfpl.git]
/
upload.php
diff --git
a/upload.php
b/upload.php
index
4d81804
..
2509a6b
100644
(file)
--- a/
upload.php
+++ b/
upload.php
@@
-103,11
+103,17
@@
function generate_filename($path, $mime = 'text/plain') {
# replace symbols with underscores
$filename = preg_replace('|[^a-z0-9_.]|', '_', $filename);
# replace symbols with underscores
$filename = preg_replace('|[^a-z0-9_.]|', '_', $filename);
+ # limit length
+ if(strlen($filename > 80)) {
+ $filename = substr($filename, -80);
+ }
+
# remove dots from the beginning (no invisible files)
$filename = preg_replace('|^\.*|', '', $filename);
# remove dots from the beginning (no invisible files)
$filename = preg_replace('|^\.*|', '', $filename);
- if(strlen($filename > 80)) {
- $filename = substr($filename, -80);
+ # make sure there's something before the extension
+ if ($filename == '') {
+ return '_';
}
# fix extension
}
# fix extension
@@
-127,6
+133,7
@@
function generate_filename($path, $mime = 'text/plain') {
}
$filename = $basename . '.' . $ext;
}
}
$filename = $basename . '.' . $ext;
}
+
return $filename;
}
return $filename;
}