@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.

Fix crash 'Duplicate entry' in account creation via external GitHub auth

Summary:
Do not recreate the thumbnail profile picture via a file transform when creating a Phorge account via external authentication via GitLab but use the already existing thumbnail file. This saves database space and fixes this crash:

#1062: Duplicate entry 'PHID-FILE-ffps4pzs36kkikrpvgdh-profile' for key 'originalPHID'

Closes T16532
Ref T16527
Ref T16528

Co-authored-by: Andre Klapper

Test Plan:
Prepare GitHub OAuth:

* Log into Github, create a new OAuth App via https://github.com/settings/applications/new
* As an admin, set up GitHub Auth provider via http://phorge.localhost/auth/
* Copy Client ID into "OAuth App ID" and Client Secret into "OAuth App Secret"
* Log out as admin

Then:

* Go to http://phorge.localhost/auth/start/ and click GitHub button
* Enter Username and Password on GitHub website, click "Sign in"
* Enter data on resulting http://phorge.localhost/auth/register/ and click "Register Account"
* Without this patch, get an error `#1062: Duplicate entry 'PHID-FILE-foobar' for key 'originalPHID'`

Also, to be sure:

* Visit your {nav profile > Manage > Edit Settings > External Accounts} and Unlink your GitHub profile (with the "x" icon)
* From the same page {nav Link External Account} to link GitHub again and confirm: it still works

Reviewers: O1 Blessed Committers, avivey, aklapper

Reviewed By: O1 Blessed Committers, avivey, aklapper

Subscribers: avivey, ajhalili2006, #affects_filed_by_subscribed_by_recap_time_squad, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #auth, #affects_filed_by_subscribed_by_recap_time_squad

Maniphest Tasks: T16527, T16528, T16532

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

authored by

Andre Klapper and committed by
Valerio Bozzolan
cc525888 a42a8abb

+1 -2
+1 -2
src/applications/auth/controller/PhabricatorAuthRegisterController.php
··· 699 699 // do meaningful policy checks anyway since they have not registered yet. 700 700 // Reaching this means the user holds the account secret key and the 701 701 // registration secret key, and thus has permission to view the image. 702 - 703 702 $file = id(new PhabricatorFileQuery()) 704 703 ->setViewer(PhabricatorUser::getOmnipotentUser()) 705 704 ->withPHIDs(array($phid)) ··· 710 709 711 710 $xform = PhabricatorFileTransform::getTransformByKey( 712 711 PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE); 713 - return $xform->executeTransformExplicit($file); 712 + return $xform->getOrExecuteTransformExplicit($file); 714 713 } 715 714 716 715 protected function renderError($message) {