mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 09:42:26 -05: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:
parent
07207e71e9
commit
e3052e8c82
13 changed files with 461 additions and 211 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue