cozy-sharing 36.0.0 → 36.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/state.js +2 -2
- package/dist/state.spec.js +12 -0
- package/package.json +2 -2
- package/src/state.js +2 -2
- package/src/state.spec.js +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [36.0.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@36.0.0...cozy-sharing@36.0.1) (2026-06-29)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **sharing:** Guard shared-path helpers against undefined path ([0365f75](https://github.com/cozy/cozy-libs/commit/0365f755ce4b4125250eb883658912ec05b77253))
|
|
11
|
+
|
|
6
12
|
# [36.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@35.0.0...cozy-sharing@36.0.0) (2026-06-25)
|
|
7
13
|
|
|
8
14
|
### Features
|
package/dist/state.js
CHANGED
|
@@ -621,7 +621,7 @@ var getApps = function getApps(state) {
|
|
|
621
621
|
};
|
|
622
622
|
|
|
623
623
|
export var hasSharedParent = function hasSharedParent(state, documentPath) {
|
|
624
|
-
if (!state.sharedPaths) {
|
|
624
|
+
if (!state.sharedPaths || !documentPath) {
|
|
625
625
|
return false; // hasSharedParent should not occur
|
|
626
626
|
}
|
|
627
627
|
|
|
@@ -630,7 +630,7 @@ export var hasSharedParent = function hasSharedParent(state, documentPath) {
|
|
|
630
630
|
});
|
|
631
631
|
};
|
|
632
632
|
export var hasSharedChild = function hasSharedChild(state, documentPath) {
|
|
633
|
-
if (!state.sharedPaths) {
|
|
633
|
+
if (!state.sharedPaths || !documentPath) {
|
|
634
634
|
return false; // hasSharedChild should not occur
|
|
635
635
|
}
|
|
636
636
|
|
package/dist/state.spec.js
CHANGED
|
@@ -574,6 +574,12 @@ describe('hasSharedParent helper', function () {
|
|
|
574
574
|
var result = hasSharedParent(state, documentPath);
|
|
575
575
|
expect(result).toBe(false);
|
|
576
576
|
});
|
|
577
|
+
it('should return false when documentPath is undefined', function () {
|
|
578
|
+
var state = {
|
|
579
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
580
|
+
};
|
|
581
|
+
expect(hasSharedParent(state, undefined)).toBe(false);
|
|
582
|
+
});
|
|
577
583
|
});
|
|
578
584
|
describe('hasSharedChild helper', function () {
|
|
579
585
|
it('returns true if a child is shared', function () {
|
|
@@ -592,6 +598,12 @@ describe('hasSharedChild helper', function () {
|
|
|
592
598
|
var result = hasSharedChild(state, documentPath);
|
|
593
599
|
expect(result).toBe(false);
|
|
594
600
|
});
|
|
601
|
+
it('should return false when documentPath is undefined', function () {
|
|
602
|
+
var state = {
|
|
603
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
604
|
+
};
|
|
605
|
+
expect(hasSharedChild(state, undefined)).toBe(false);
|
|
606
|
+
});
|
|
595
607
|
});
|
|
596
608
|
describe('getSharedDocIdsBySharings method', function () {
|
|
597
609
|
it('should test getSharedDocIdsBySharings', function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "36.0.
|
|
3
|
+
"version": "36.0.1",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -85,5 +85,5 @@
|
|
|
85
85
|
"sideEffects": [
|
|
86
86
|
"*.css"
|
|
87
87
|
],
|
|
88
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "bfe63577a7c6ff6a68e80095a96e9fe5d1e2aa8f"
|
|
89
89
|
}
|
package/src/state.js
CHANGED
|
@@ -506,14 +506,14 @@ const getPermissionById = (state, id) =>
|
|
|
506
506
|
const getApps = state => state.apps
|
|
507
507
|
|
|
508
508
|
export const hasSharedParent = (state, documentPath) => {
|
|
509
|
-
if (!state.sharedPaths) {
|
|
509
|
+
if (!state.sharedPaths || !documentPath) {
|
|
510
510
|
return false // hasSharedParent should not occur
|
|
511
511
|
}
|
|
512
512
|
return state.sharedPaths.some(path => documentPath.indexOf(`${path}/`) === 0)
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
export const hasSharedChild = (state, documentPath) => {
|
|
516
|
-
if (!state.sharedPaths) {
|
|
516
|
+
if (!state.sharedPaths || !documentPath) {
|
|
517
517
|
return false // hasSharedChild should not occur
|
|
518
518
|
}
|
|
519
519
|
const ret = state.sharedPaths.some(
|
package/src/state.spec.js
CHANGED
|
@@ -739,6 +739,13 @@ describe('hasSharedParent helper', () => {
|
|
|
739
739
|
const result = hasSharedParent(state, documentPath)
|
|
740
740
|
expect(result).toBe(false)
|
|
741
741
|
})
|
|
742
|
+
|
|
743
|
+
it('should return false when documentPath is undefined', () => {
|
|
744
|
+
const state = {
|
|
745
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
746
|
+
}
|
|
747
|
+
expect(hasSharedParent(state, undefined)).toBe(false)
|
|
748
|
+
})
|
|
742
749
|
})
|
|
743
750
|
|
|
744
751
|
describe('hasSharedChild helper', () => {
|
|
@@ -759,6 +766,13 @@ describe('hasSharedChild helper', () => {
|
|
|
759
766
|
const result = hasSharedChild(state, documentPath)
|
|
760
767
|
expect(result).toBe(false)
|
|
761
768
|
})
|
|
769
|
+
|
|
770
|
+
it('should return false when documentPath is undefined', () => {
|
|
771
|
+
const state = {
|
|
772
|
+
sharedPaths: ['/dir0/doc0', '/dir1', '/dir2/doc1']
|
|
773
|
+
}
|
|
774
|
+
expect(hasSharedChild(state, undefined)).toBe(false)
|
|
775
|
+
})
|
|
762
776
|
})
|
|
763
777
|
|
|
764
778
|
describe('getSharedDocIdsBySharings method', () => {
|