changeset 732:98702a1251cd

merged
author HIROSE Yuuji <yuuji@gentei.org>
date Tue, 02 Jun 2020 07:52:04 +0900
parents 33df7d50532e (diff) b73e2399994c (current diff)
children 4f1e3622d9d6 1ab3cc61a462
files s4-funcs.sh
diffstat 1 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Sun May 31 21:30:29 2020 +0900
+++ b/s4-funcs.sh	Tue Jun 02 07:52:04 2020 +0900
@@ -1461,9 +1461,6 @@
 		mogrify -quality 75 -resize $maximagexy'>' "$tmpd/$v"
 		err "Mogrified: `ls -lF $tmpd/$v`"	# 2020-05-31
 		;;
-	      [Aa]pplication/*-empty)
-		err "Stream-Empty found: [$v]"; cp "$tmpf" tmp/
-		;;
 	    esac
 	    if ! echo "$mimetype" | egrep "$file_accept_egrep" >/dev/null 2>&1
 	    then
@@ -3647,6 +3644,7 @@
   #	6: Password length too short
   #	7: Password mismatch
   #	8: Old password incorrect
+  #	9: Duplicated post
   rowid=`getpar rowid`
   if [ ! -e $1 ]; then
     echo "テーブル定義ファイルが見付かりません" | html p
@@ -3733,6 +3731,22 @@
     done
   else
     # New entry
+    # XXX: WORK-AROUND FOR SOME STUPID BROWSER
+    #      Avoid empty repost of article.
+    if [ x"$tbl" = x"article" ]; then
+      # If rowid is empty and ID exists in article-table, that is REPOST!
+      aid=`getpar id`
+      xaid=`query "SELECT id FROM $tbl WHERE id='$aid';"`
+      if [ -n "$xaid" ]; then
+	# REPOST of article
+	html p <<-EOF
+	書き込み直後のリロードなので上書きを回避します。
+	最新記事は末尾の「再読み込み」ボタンから見てください。
+	EOF
+	err "Repost aid=$aid Browser=[$HTTP_USER_AGENT] user=$user"
+	return 9			# STOP Duplicated posting
+      fi
+    fi
     # Generate values() for primary keys
     for col in `gettblpkey $tbl`; do
       # Genuine primary keys for _m and _s
@@ -3788,6 +3802,10 @@
 	      case `gettbl_coltype $tbl/$origcol` in
 		image|document|binary)
 		  file=$tmpd/`getparfilename $v`
+		  if [ ! -s "$file" ]; then	# Maybe stupid REPOST
+		    err "Empty REPOST by [$HTTP_USER_AGENT] user=$user"
+		    continue
+		  fi
 		  ## err type=file=$file
 		  [ -z "$file" ] && continue
 		  bn=`sqlquotestr "${file##*/}"`

yatex.org