mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[chore]: Bump github.com/gin-contrib/sessions from 0.0.5 to 1.0.0 (#2782)
This commit is contained in:
12
vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go
generated
vendored
12
vendor/go.mongodb.org/mongo-driver/bson/primitive/objectid.go
generated
vendored
@@ -82,18 +82,18 @@ func ObjectIDFromHex(s string) (ObjectID, error) {
|
||||
return NilObjectID, ErrInvalidHex
|
||||
}
|
||||
|
||||
b, err := hex.DecodeString(s)
|
||||
var oid [12]byte
|
||||
_, err := hex.Decode(oid[:], []byte(s))
|
||||
if err != nil {
|
||||
return NilObjectID, err
|
||||
}
|
||||
|
||||
var oid [12]byte
|
||||
copy(oid[:], b)
|
||||
|
||||
return oid, nil
|
||||
}
|
||||
|
||||
// IsValidObjectID returns true if the provided hex string represents a valid ObjectID and false if not.
|
||||
//
|
||||
// Deprecated: Use ObjectIDFromHex and check the error instead.
|
||||
func IsValidObjectID(s string) bool {
|
||||
_, err := ObjectIDFromHex(s)
|
||||
return err == nil
|
||||
@@ -183,7 +183,7 @@ func processUniqueBytes() [5]byte {
|
||||
var b [5]byte
|
||||
_, err := io.ReadFull(rand.Reader, b[:])
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot initialize objectid package with crypto.rand.Reader: %v", err))
|
||||
panic(fmt.Errorf("cannot initialize objectid package with crypto.rand.Reader: %w", err))
|
||||
}
|
||||
|
||||
return b
|
||||
@@ -193,7 +193,7 @@ func readRandomUint32() uint32 {
|
||||
var b [4]byte
|
||||
_, err := io.ReadFull(rand.Reader, b[:])
|
||||
if err != nil {
|
||||
panic(fmt.Errorf("cannot initialize objectid package with crypto.rand.Reader: %v", err))
|
||||
panic(fmt.Errorf("cannot initialize objectid package with crypto.rand.Reader: %w", err))
|
||||
}
|
||||
|
||||
return (uint32(b[0]) << 0) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24)
|
||||
|
Reference in New Issue
Block a user