Commit 314f331
authored
* fix: minimal fix for airgap sample trust and factory URL source comparison
Four targeted changes to fix workspace source comparison and airgap sample
trust for factory flows like:
/load-factory?url=https%3A%2F%2Fregistry.devfile.io%2F...&storageType=per-user
1. Preferences/helpers.ts — automatically trust airgap sample URLs
(matching /dashboard/api/airgap-sample/devfile/download) so the factory
flow proceeds without requiring an explicit trust grant. Minor refactor:
extract urlString before early-return guards.
2. ImportFromGit/helpers.ts — rename REVISION import to REVISION_ATTR
(both are 'revision', so no functional change; aligns with the canonical
constant name used in buildFactoryParams.ts).
3. buildFactoryParams.ts — apply decodeURIComponent() in getSourceUrl() so
factoryParams.sourceUrl matches workspace.source. The factory hash
double-encodes airgap URLs (%253F → %3F after first URLSearchParams decode),
while workspace.source applies a second decode via URLSearchParams.get()
(%3F → ?). Without this normalization the two sides differ and
CheckExistingWorkspaces always creates a new workspace.
4. workspace-adapter/index.ts — replace split('&') + split('=')[1] with
URLSearchParams.get('url') to extract the URL from the DevWorkspace
annotation. The old approach truncated the value at the second '=' sign,
breaking URLs whose query parameters contain '=' characters (e.g.
base64-encoded values). URLSearchParams.get() also applies the same
percent-decoding as point 3, keeping both sides consistent.
Assisted-by: Claude Sonnet 4.6
* fix(typo): rename devfileSourse → devfileSource in workspace-adapter
"Sourse" is a misspelling of "Source". Rename the two local variables
devfileSourseStr and devfileSourse to devfileSourceStr and devfileSource.
No functional change.
Assisted-by: Claude Sonnet 4.6
* chore(license): add jsbn@0.1.1 to dev dependency excludes
Assisted-by: Claude Sonnet 4.6
* fix: GitRepo component appends factory params to the Git repo URL (CRW-9659)
The GitRepoFormGroup.getSource() method parsed the DevWorkspace factory
annotation with split('&') + split('=') and then reconstructed the URL by
appending every other factory param (che-editor, storageType, …).
For airgap sample URLs this produced a malformed "Git repo URL" like:
"…/download?id?che-editor=che-incubator/che-code/latest&storageType=per-user"
Two bugs in the old parser:
1. split('=')[1] truncated the URL value at the second '=' sign.
2. All non-url params were re-joined and appended to the URL, adding
factory orchestration params that have no place in the Git repo URL.
Fix: replace the parser with URLSearchParams.get('url').
URLSearchParams.get() correctly handles '=' inside values (e.g. ?id=foo)
and decodes percent-encoded characters (%3F → ?, %3D → =) so the URL shown
in the Overview tab matches the clean devfile download URL.
Add regression test: airgap sample URL with che-editor and storageType in
the factory params — verifies that only the decoded 'url' value appears and
factory params are never appended.
Also stage a CSS line-wrap format fix in SamplesList/Gallery/Card.
Assisted-by: Claude Sonnet 4.6
* fix: GitRepo URL truncated and double-'?' for airgap factory params (CRW-9659)
The GitRepoFormGroup.getSource() method used split('=')[1] to extract the
'url' value from the factory annotation params string. For airgap sample URLs
whose query string contains '=' characters (e.g. %3Fid%3Dnodejs-express,
decoded by URLSearchParams to ?id=nodejs-express) this truncated the value at
the second '=' and then appended other factory params with '?' as separator,
producing a malformed double-'?' URL:
"…/download?id?che-editor=che-incubator/che-code/latest&storageType=per-user"
^ missing =nodejs-express ^ wrong separator
Fix: use URLSearchParams.get('url') to extract the full URL value.
URLSearchParams handles '=' inside values correctly and decodes percent-encoded
characters (%3F→?, %3D→=). The remaining factory params (editor-image,
storageType, etc.) are still appended to represent the full workspace config;
the separator is chosen based on whether the URL already has a '?'.
Add regression test that verifies:
- No double '?' in the resulting URL
- Decoded query value (id=nodejs-express) is preserved
- Factory params are appended with '&', not a second '?'
Also commit a CSS line-wrap format fix in SamplesList/Gallery/Card.
Assisted-by: Claude Sonnet 4.6
---------
Signed-off-by: Oleksii Orel <oorel@redhat.com>
1 parent 11f3186 commit 314f331
8 files changed
Lines changed: 124 additions & 47 deletions
File tree
- .deps/EXCLUDED
- packages/dashboard-frontend/src
- components/ImportFromGit
- pages
- GetStarted/SamplesList/Gallery/Card
- WorkspaceDetails/OverviewTab/GitRepo
- __tests__
- services
- helpers/factoryFlow
- workspace-adapter
- store/Workspaces/Preferences
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
326 | 326 | | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
| 329 | + | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| |||
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
452 | | - | |
| 452 | + | |
453 | 453 | | |
454 | 454 | | |
455 | 455 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
Lines changed: 38 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
129 | 167 | | |
130 | 168 | | |
131 | 169 | | |
| |||
Lines changed: 28 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
83 | | - | |
| 82 | + | |
| 83 | + | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
110 | 109 | | |
111 | 110 | | |
112 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
113 | 119 | | |
114 | 120 | | |
115 | 121 | | |
| |||
Lines changed: 18 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
109 | 124 | | |
110 | 125 | | |
111 | 126 | | |
| |||
Lines changed: 17 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
185 | 185 | | |
186 | 186 | | |
187 | 187 | | |
188 | | - | |
189 | | - | |
| 188 | + | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
216 | 217 | | |
217 | 218 | | |
218 | 219 | | |
219 | | - | |
| 220 | + | |
220 | 221 | | |
221 | 222 | | |
222 | 223 | | |
223 | 224 | | |
224 | | - | |
| 225 | + | |
225 | 226 | | |
226 | 227 | | |
227 | 228 | | |
| |||
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
81 | 90 | | |
82 | 91 | | |
83 | 92 | | |
84 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
85 | 101 | | |
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
91 | 107 | | |
92 | | - | |
93 | 108 | | |
94 | 109 | | |
95 | 110 | | |
| |||
0 commit comments