Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3523948
D10099.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D10099.diff
View Options
diff --git a/keyserver/src/creators/invite-link-creator.js b/keyserver/src/creators/invite-link-creator.js
--- a/keyserver/src/creators/invite-link-creator.js
+++ b/keyserver/src/creators/invite-link-creator.js
@@ -2,6 +2,7 @@
import Filter from 'bad-words';
+import { inviteLinkBlobHash } from 'lib/shared/invite-links.js';
import type {
CreateOrUpdatePublicLinkRequest,
InviteLink,
@@ -152,7 +153,7 @@
function getInviteLinkBlob(
request: CreateOrUpdatePublicLinkRequest,
): Promise<BlobDownloadResult> {
- const hash = `invite_${request.name}`;
+ const hash = inviteLinkBlobHash(request.name);
return download(hash);
}
diff --git a/keyserver/src/deleters/link-deleters.js b/keyserver/src/deleters/link-deleters.js
--- a/keyserver/src/deleters/link-deleters.js
+++ b/keyserver/src/deleters/link-deleters.js
@@ -1,5 +1,6 @@
// @flow
+import { inviteLinkBlobHash } from 'lib/shared/invite-links.js';
import type { DisableInviteLinkRequest } from 'lib/types/link-types.js';
import { threadPermissions } from 'lib/types/thread-permission-types.js';
import { ServerError } from 'lib/utils/errors.js';
@@ -32,7 +33,7 @@
if (row?.blobHolder) {
await deleteBlob(
{
- hash: `invite_${request.name}`,
+ hash: inviteLinkBlobHash(request.name),
holder: row.blobHolder,
},
true,
diff --git a/lib/shared/invite-links.js b/lib/shared/invite-links.js
--- a/lib/shared/invite-links.js
+++ b/lib/shared/invite-links.js
@@ -11,4 +11,8 @@
const defaultErrorMessage = 'Unknown error.';
-export { inviteLinkErrorMessages, defaultErrorMessage };
+function inviteLinkBlobHash(secret: string): string {
+ return `invite_${secret}`;
+}
+
+export { inviteLinkErrorMessages, defaultErrorMessage, inviteLinkBlobHash };
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 10:44 AM (16 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2698863
Default Alt Text
D10099.diff (1 KB)
Attached To
Mode
D10099: [keyserver] Introduce a util function that generates invite link blob hash
Attached
Detach File
Event Timeline
Log In to Comment