mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[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
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user