]> git.plutz.net Git - serve0/commitdiff
safer handling of file names
authorpaul <paul@plutz.net>
Wed, 5 Aug 2015 21:10:29 +0000 (21:10 +0000)
committerpaul <paul@plutz.net>
Wed, 5 Aug 2015 21:10:29 +0000 (21:10 +0000)
svn path=/trunk/; revision=77

pages/common.sh

index 38296dfd8e28358bd0983a7b6d17962fdc589fc1..6257aad6e3fba469e17f8143c2cd05dcae9ab5fb 100755 (executable)
@@ -49,8 +49,8 @@ _printVideo(){
   else
     videofile="${_DATA}/videos/$info"
     thumb="${_DATA}/thumbs/$info.jpg"
-    [ -r "$meta"  ] || ${_EXEC}/helpers/genmeta.sh "$videofile" "$meta"
-    [ -r "$thumb" ] || ${_EXEC}/helpers/genthumb.sh "$videofile" "$thumb"
+    [ -r "$meta"  ] || ${_EXEC}/helpers/genmeta.sh "$videofile" "$meta" >/dev/null
+    [ -r "$thumb" ] || ${_EXEC}/helpers/genthumb.sh "$videofile" "$thumb" >/dev/null
 
     head -n1 "$meta" |read length width height filename
     [ -z "$length" ] && length=0
@@ -61,6 +61,7 @@ _printVideo(){
     video="$(urlsafe "videos/$info")"
     thumb="$(urlsafe "thumbs/$info.jpg")"
     linkinfo="$(urlsafe "$info")"
+    htmlinfo="$(htmlsafe "$info")"
 
     [ "$(($length % 60))" -lt 10 ] && minutes="$(($length / 60)):0$(($length % 60))" \
                                    || minutes="$(($length / 60)):$(($length % 60))"
@@ -70,9 +71,9 @@ _printVideo(){
         <a class="watchlink" name="${linkinfo}" href="?action=watch&i=${linkinfo}">
           <img src="$thumb" alt="Preview not yet available">
         </a>
-        <h2>$info</h2>
+        <h2>${htmlinfo}</h2>
         
-        <input type="checkbox" name="tagsel" value="$info">
+        <input type="checkbox" name="tagsel" value="${htmlinfo}">
         <span class="info property">${minutes}min</span>
         <span class="info property">${width}x${height}</span>
        $(printf %s "$tags" |sed -r 's:\|*([^|]+)\|*: <span class="info tag">\1</span>:g')