changeset 730:2c0c25fc9f68

Workaround for reposting from resuming browsers
author HIROSE Yuuji <yuuji@gentei.org>
date Mon, 01 Jun 2020 19:31:36 +0900
parents 01be32e89ccd
children 33df7d50532e
files s4-funcs.sh
diffstat 1 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/s4-funcs.sh	Sun May 31 19:06:46 2020 +0900
+++ b/s4-funcs.sh	Mon Jun 01 19:31:36 2020 +0900
@@ -1459,9 +1459,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
@@ -3645,6 +3642,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
@@ -3731,6 +3729,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]"
+	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

yatex.org