diff options
author | 2024-01-26 14:17:10 +0100 | |
---|---|---|
committer | 2024-01-26 14:17:10 +0100 | |
commit | e3052e8c825da699162ea25367e860ac3c66f461 (patch) | |
tree | 3d13e83413d4a85ab694034d6c9772f9ec64268a /internal/regexes | |
parent | [performance] cache library performance enhancements (updates go-structr => v... (diff) | |
download | gotosocial-e3052e8c825da699162ea25367e860ac3c66f461.tar.xz |
[bugfix] Don't return Account or Status if new and dereferencing failed, other small fixes (#2563)
* tidy up account, status, webfingering logic a wee bit
* go fmt
* invert published check
* alter resp initialization
* get Published from account in typeutils
* don't instantiate error for no darn good reason
* shadow err
* don't repeat error codes in wrapped errors
* don't wrap error unnecessarily
Diffstat (limited to 'internal/regexes')
-rw-r--r-- | internal/regexes/regexes.go | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/internal/regexes/regexes.go b/internal/regexes/regexes.go index 347a8a98b..25fcfc03a 100644 --- a/internal/regexes/regexes.go +++ b/internal/regexes/regexes.go @@ -57,20 +57,22 @@ const ( Path parts / capture. */ - userPathPrefix = `^/?` + users + `/(` + usernameRelaxed + `)` - userPath = userPathPrefix + `$` - publicKeyPath = userPathPrefix + `/` + publicKey + `$` - inboxPath = userPathPrefix + `/` + inbox + `$` - outboxPath = userPathPrefix + `/` + outbox + `$` - followersPath = userPathPrefix + `/` + followers + `$` - followingPath = userPathPrefix + `/` + following + `$` - likedPath = userPathPrefix + `/` + liked + `$` - followPath = userPathPrefix + `/` + follow + `/(` + ulid + `)$` - likePath = userPathPrefix + `/` + liked + `/(` + ulid + `)$` - statusesPath = userPathPrefix + `/` + statuses + `/(` + ulid + `)$` - blockPath = userPathPrefix + `/` + blocks + `/(` + ulid + `)$` - reportPath = `^/?` + reports + `/(` + ulid + `)$` - filePath = `^/?(` + ulid + `)/([a-z]+)/([a-z]+)/(` + ulid + `)\.([a-z0-9]+)$` + userPathPrefix = `^/?` + users + `/(` + usernameRelaxed + `)` + userPath = userPathPrefix + `$` + userWebPathPrefix = `^/?` + `@(` + usernameRelaxed + `)` + userWebPath = userWebPathPrefix + `$` + publicKeyPath = userPathPrefix + `/` + publicKey + `$` + inboxPath = userPathPrefix + `/` + inbox + `$` + outboxPath = userPathPrefix + `/` + outbox + `$` + followersPath = userPathPrefix + `/` + followers + `$` + followingPath = userPathPrefix + `/` + following + `$` + likedPath = userPathPrefix + `/` + liked + `$` + followPath = userPathPrefix + `/` + follow + `/(` + ulid + `)$` + likePath = userPathPrefix + `/` + liked + `/(` + ulid + `)$` + statusesPath = userPathPrefix + `/` + statuses + `/(` + ulid + `)$` + blockPath = userPathPrefix + `/` + blocks + `/(` + ulid + `)$` + reportPath = `^/?` + reports + `/(` + ulid + `)$` + filePath = `^/?(` + ulid + `)/([a-z]+)/([a-z]+)/(` + ulid + `)\.([a-z0-9]+)$` ) var ( @@ -110,6 +112,9 @@ var ( // UserPath validates and captures the username part from eg /users/example_username. UserPath = regexp.MustCompile(userPath) + // UserWebPath validates and captures the username part from eg /@example_username. + UserWebPath = regexp.MustCompile(userWebPath) + // PublicKeyPath parses a path that validates and captures the username part from eg /users/example_username/main-key PublicKeyPath = regexp.MustCompile(publicKeyPath) |