diff --git a/batch/savepapers.php b/batch/savepapers.php index 24f133bfc..9019db3fa 100644 --- a/batch/savepapers.php +++ b/batch/savepapers.php @@ -58,10 +58,10 @@ function __construct(Conf $conf) { function set_args($arg) { $this->quiet = isset($arg["q"]); $this->ignore_errors = isset($arg["ignore-errors"]); - if (isset($args["ignore-pid"])) { + if (isset($arg["ignore-pid"])) { $this->pidflags |= Paper_API::PIDFLAG_IGNORE_PID; } - if (isset($args["match-title"])) { + if (isset($arg["match-title"])) { $this->pidflags |= Paper_API::PIDFLAG_MATCH_TITLE; } $this->disable_users = isset($arg["disable-users"]); diff --git a/src/api/api_paper.php b/src/api/api_paper.php index c1603f29b..5d4e0eb0e 100644 --- a/src/api/api_paper.php +++ b/src/api/api_paper.php @@ -179,7 +179,8 @@ static function analyze_json_pid(Conf $conf, $j, $pidflags = 0) { } unset($j->pid, $j->id); } - if (!isset($j->pid) && !isset($j->id) + if (!isset($j->pid) + && !isset($j->id) && ($pidflags & self::PIDFLAG_MATCH_TITLE) !== 0 && is_string($j->title ?? null)) { $pids = Dbl::fetch_first_columns($conf->dblink, "select paperId from Paper where title=?", simplify_whitespace($j->title)); diff --git a/src/papercolumns/pc_tag.php b/src/papercolumns/pc_tag.php index 4f30732bb..0cde45b75 100644 --- a/src/papercolumns/pc_tag.php +++ b/src/papercolumns/pc_tag.php @@ -37,7 +37,7 @@ function add_decoration($decor) { if ($decor === "edit") { $this->editable = true; return $this->__add_decoration($decor); - } else if (preg_match('/\A%\d*(?:\.\d*)[bdeEfFgGoxX]\z/', $decor)) { + } else if (preg_match('/\A%?\d*(?:\.\d*)[bdeEfFgGoxX]\z/', $decor)) { $this->__add_decoration($decor, [$this->real_format]); $this->real_format = $decor; return true;