fix probable bugs, package names and keywords used as identifiers (#428)
Signed-off-by: MohitKS5 <mohitkumarsingh907@gmail.com>
This commit is contained in:
parent
58c10c6d54
commit
aff401ed06
@ -177,8 +177,8 @@ func queryIDServer(
|
||||
// Returns an error if the request failed to send or if the response couldn't be parsed.
|
||||
func queryIDServerLookup(ctx context.Context, body *MembershipRequest) (*idServerLookupResponse, error) {
|
||||
address := url.QueryEscape(body.Address)
|
||||
url := fmt.Sprintf("https://%s/_matrix/identity/api/v1/lookup?medium=%s&address=%s", body.IDServer, body.Medium, address)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
requestURL := fmt.Sprintf("https://%s/_matrix/identity/api/v1/lookup?medium=%s&address=%s", body.IDServer, body.Medium, address)
|
||||
req, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -237,8 +237,8 @@ func queryIDServerStoreInvite(
|
||||
// These can be easily retrieved by requesting the public rooms API
|
||||
// server's database.
|
||||
|
||||
url := fmt.Sprintf("https://%s/_matrix/identity/api/v1/store-invite", body.IDServer)
|
||||
req, err := http.NewRequest(http.MethodPost, url, strings.NewReader(data.Encode()))
|
||||
requestURL := fmt.Sprintf("https://%s/_matrix/identity/api/v1/store-invite", body.IDServer)
|
||||
req, err := http.NewRequest(http.MethodPost, requestURL, strings.NewReader(data.Encode()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -265,8 +265,8 @@ func queryIDServerStoreInvite(
|
||||
// Returns an error if the request couldn't be sent, if its body couldn't be parsed
|
||||
// or if the key couldn't be decoded from base64.
|
||||
func queryIDServerPubKey(ctx context.Context, idServerName string, keyID string) ([]byte, error) {
|
||||
url := fmt.Sprintf("https://%s/_matrix/identity/api/v1/pubkey/%s", idServerName, keyID)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
requestURL := fmt.Sprintf("https://%s/_matrix/identity/api/v1/pubkey/%s", idServerName, keyID)
|
||||
req, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -107,8 +107,8 @@ func CheckAssociation(
|
||||
return false, "", "", err
|
||||
}
|
||||
|
||||
url := fmt.Sprintf("https://%s/_matrix/identity/api/v1/3pid/getValidated3pid?sid=%s&client_secret=%s", creds.IDServer, creds.SID, creds.Secret)
|
||||
req, err := http.NewRequest(http.MethodGet, url, nil)
|
||||
requestURL := fmt.Sprintf("https://%s/_matrix/identity/api/v1/3pid/getValidated3pid?sid=%s&client_secret=%s", creds.IDServer, creds.SID, creds.Secret)
|
||||
req, err := http.NewRequest(http.MethodGet, requestURL, nil)
|
||||
if err != nil {
|
||||
return false, "", "", err
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ func GenerateThumbnails(
|
||||
logger.WithError(err).WithField("src", src).Error("Failed to read src file")
|
||||
return false, err
|
||||
}
|
||||
for _, config := range configs {
|
||||
for _, singleConfig := range configs {
|
||||
// Note: createThumbnail does locking based on activeThumbnailGeneration
|
||||
busy, err = createThumbnail(
|
||||
ctx, src, img, types.ThumbnailSize(config), mediaMetadata,
|
||||
ctx, src, img, types.ThumbnailSize(singleConfig), mediaMetadata,
|
||||
activeThumbnailGeneration, maxThumbnailGenerators, db, logger,
|
||||
)
|
||||
if err != nil {
|
||||
|
@ -91,22 +91,22 @@ func updateMembership(
|
||||
) ([]api.OutputEvent, error) {
|
||||
var err error
|
||||
// Default the membership to Leave if no event was added or removed.
|
||||
old := leave
|
||||
new := leave
|
||||
oldMembership := leave
|
||||
newMembership := leave
|
||||
|
||||
if remove != nil {
|
||||
old, err = remove.Membership()
|
||||
oldMembership, err = remove.Membership()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if add != nil {
|
||||
new, err = add.Membership()
|
||||
newMembership, err = add.Membership()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if old == new && new != join {
|
||||
if oldMembership == newMembership && newMembership != join {
|
||||
// If the membership is the same then nothing changed and we can return
|
||||
// immediately, unless it's a Join update (e.g. profile update).
|
||||
return updates, nil
|
||||
@ -117,16 +117,16 @@ func updateMembership(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
switch new {
|
||||
switch newMembership {
|
||||
case invite:
|
||||
return updateToInviteMembership(mu, add, updates)
|
||||
case join:
|
||||
return updateToJoinMembership(mu, add, updates)
|
||||
case leave, ban:
|
||||
return updateToLeaveMembership(mu, add, new, updates)
|
||||
return updateToLeaveMembership(mu, add, newMembership, updates)
|
||||
default:
|
||||
panic(fmt.Errorf(
|
||||
"input: membership %q is not one of the allowed values", new,
|
||||
"input: membership %q is not one of the allowed values", newMembership,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user