Skip to content

Commit

Permalink
Merge pull request #182 from pixlise/feature/max-field-length-increase
Browse files Browse the repository at this point in the history
Max Field Bump, Local Mongo Direct Connect
  • Loading branch information
RyanStonebraker authored Mar 16, 2024
2 parents c0933bd + af41d4b commit a856634
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/ws/wsHelpers/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"github.com/pixlise/core/v4/core/errorwithstatus"
)

const IdFieldMaxLength = 16
const IdFieldMaxLength = 32
const Auth0UserIdFieldMaxLength = 32
const DescriptionFieldMaxLength = 512
const DescriptionFieldMaxLength = 1024 * 5
const SourceCodeMaxLength = 1024 * 1024 * 5 // Trying to be very generous here, but maybe this is not enough?
const TagListMaxLength = 100

Expand Down
2 changes: 1 addition & 1 deletion core/mongoDBConnection/local.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func connectToLocalMongoDB(log logger.ILogger) (*mongo.Client, error) {
mongoUri = "mongodb://localhost"
}
//ctx := context.Background()
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(mongoUri).SetMonitor(cmdMonitor))
client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI(mongoUri).SetMonitor(cmdMonitor).SetDirect(true))
if err != nil {
return nil, fmt.Errorf("Failed to create new local mongo DB connection: %v", err)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,12 +389,12 @@ func testAddRemoveUserAsGroupMember(u2 wstestlib.ScriptedTestUser, nonAdminUserI
func testUserGroupAdminAdd(u2 wstestlib.ScriptedTestUser, nonAdminUserId string) {
// Edits by admin of group
u2.AddSendReqAction("Add admin user to bad group id",
`{"userGroupAddAdminReq":{"groupId": "way-too-long-group-id", "adminUserId": "u123"}}`,
`{"userGroupAddAdminReq":{"groupId": "way-too-long-group-id-way-too-long-group-id-way-too-long-group-id-way-too-long-group-id", "adminUserId": "u123"}}`,
`{"msgId":15,"status":"WS_BAD_REQUEST","errorText": "GroupId is too long","userGroupAddAdminResp":{}}`,
)

u2.AddSendReqAction("Add bad admin user id to group id",
`{"userGroupAddAdminReq":{"groupId": "non-existant", "adminUserId": "admin-user-id-that-is-way-too-long even-for-auth0"}}`,
`{"userGroupAddAdminReq":{"groupId": "non-existant", "adminUserId": "admin-user-id-that-is-way-too-long even-for-auth0-admin-user-id-that-is-way-too-long even-for-auth0"}}`,
`{"msgId":16,"status":"WS_BAD_REQUEST","errorText": "AdminUserId is too long","userGroupAddAdminResp":{}}`,
)

Expand Down

0 comments on commit a856634

Please sign in to comment.