File tree 3 files changed +12
-5
lines changed
3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ This driver uses semantic versioning:
18
18
19
19
### Added
20
20
21
- - Implemented ` toJSON ` methods for ` ArangoError ` and ` HttpError `
21
+ - Implemented ` toJSON ` methods for ` ArangoError ` and ` HttpError ` ( [ # 632 ] ( https://github.com/arangodb/arangojs/issues/632 ) )
22
22
23
23
This prevents an error where ` JSON.stringify ` would reliably throw if passed
24
24
an instance of either of these error types generated by arangojs. Note that
@@ -27,7 +27,7 @@ This driver uses semantic versioning:
27
27
28
28
### Fixed
29
29
30
- - Stack traces are now improved for most errors when using ` precaptureStackTraces `
30
+ - Stack traces are now improved for most errors when using ` precaptureStackTraces ` ( [ # 722 ] ( https://github.com/arangodb/arangojs/issues/722 ) )
31
31
32
32
Previously this option would only affect network errors, making it far less
33
33
useful than intended. Now parsing errors, ` ArangoError ` instances and HTTP
@@ -40,6 +40,12 @@ This driver uses semantic versioning:
40
40
be accessed prior to the request being sent, causing a noticeable delay even
41
41
when no error occurs.
42
42
43
+ - Fixed document selector validation in ` collection.edges ` and its variants ([ #704 ] ( https://github.com/arangodb/arangojs/issues/704 ) )
44
+
45
+ These methods previously only permitted start vertices that are documents
46
+ within the edge collection itself. This behavior has now been corrected to
47
+ permit start vertices outside the collection, as expected.
48
+
43
49
## [ 7.3.0] - 2021-03-08
44
50
45
51
### Changed
Original file line number Diff line number Diff line change @@ -3629,7 +3629,7 @@ export class Collection<T extends object = any>
3629
3629
path : `/_api/edges/${ this . _name } ` ,
3630
3630
qs : {
3631
3631
direction,
3632
- vertex : _documentHandle ( selector , this . _name ) ,
3632
+ vertex : _documentHandle ( selector , this . _name , false ) ,
3633
3633
} ,
3634
3634
} ,
3635
3635
( res ) => res . body
Original file line number Diff line number Diff line change @@ -112,7 +112,8 @@ export type DocumentSelector = ObjectWithId | ObjectWithKey | string;
112
112
*/
113
113
export function _documentHandle (
114
114
selector : DocumentSelector ,
115
- collectionName : string
115
+ collectionName : string ,
116
+ strict : boolean = true
116
117
) : string {
117
118
if ( typeof selector !== "string" ) {
118
119
if ( selector . _id ) {
@@ -126,7 +127,7 @@ export function _documentHandle(
126
127
) ;
127
128
}
128
129
if ( selector . includes ( "/" ) ) {
129
- if ( ! selector . startsWith ( `${ collectionName } /` ) ) {
130
+ if ( strict && ! selector . startsWith ( `${ collectionName } /` ) ) {
130
131
throw new Error (
131
132
`Document ID "${ selector } " does not match collection name "${ collectionName } "`
132
133
) ;
You can’t perform that action at this time.
0 commit comments