@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make sure `offset` is an integer

Summary:
Older git versions allowed the `--skip` to get empty string as value and interpreted that to an int.
We were sending `null` in some places where we wanted a `0`, so it all worked out.

Since https://git.kernel.org/pub/scm/git/git.git/commit/revision.c?id=71a1e94821666909b7b2bd62a36244c601f8430e git fails when provided empty string for an integer.

See Q124 and T15783.

Test Plan: Have recent git version (that fails with `--skip ''`, navigate to `/diffusion/1/history/master/`) - see history.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25575

+9 -2
+7
src/applications/conduit/protocol/ConduitAPIRequest.php
··· 17 17 return coalesce(idx($this->params, $key), $default); 18 18 } 19 19 20 + public function getIntValue($key, $default = 'undefined_magic_text') { 21 + if ($default === 'undefined_magic_text' && !$this->getValueExists($key)) { 22 + throw new Exception(pht('Required int param not provided: %s', $key)); 23 + } 24 + return (int)$this->getValue($key, $default); 25 + } 26 + 20 27 public function getValueExists($key) { 21 28 return array_key_exists($key, $this->params); 22 29 }
+2 -2
src/applications/diffusion/conduit/DiffusionHistoryQueryConduitAPIMethod.php
··· 51 51 $path = null; 52 52 } 53 53 54 - $offset = $request->getValue('offset'); 55 - $limit = $request->getValue('limit'); 54 + $offset = $request->getIntValue('offset'); 55 + $limit = $request->getIntValue('limit', 100); 56 56 57 57 if (phutil_nonempty_string($against_hash)) { 58 58 $commit_range = "{$against_hash}..{$commit_hash}";