|
1 | 1 | package io.snyk.languageserver.protocolextension;
|
2 | 2 |
|
3 |
| -import static io.snyk.eclipse.plugin.domain.ProductConstants.DIAGNOSTIC_SOURCE_SNYK_CODE; |
4 | 3 | import static io.snyk.eclipse.plugin.domain.ProductConstants.DISPLAYED_CODE_QUALITY;
|
5 | 4 | import static io.snyk.eclipse.plugin.domain.ProductConstants.DISPLAYED_CODE_SECURITY;
|
6 | 5 | import static io.snyk.eclipse.plugin.domain.ProductConstants.LSP_SOURCE_TO_SCAN_PARAMS;
|
|
23 | 22 | import static io.snyk.eclipse.plugin.views.snyktoolview.ISnykToolView.getPlural;
|
24 | 23 |
|
25 | 24 | import java.io.File;
|
26 |
| -import java.io.UnsupportedEncodingException; |
27 | 25 | import java.net.URI;
|
28 | 26 | import java.net.URISyntaxException;
|
29 |
| -import java.net.URLDecoder; |
30 | 27 | import java.nio.file.InvalidPathException;
|
31 | 28 | import java.nio.file.Path;
|
32 | 29 | import java.nio.file.Paths;
|
33 | 30 | import java.util.ArrayList;
|
34 | 31 | import java.util.Arrays;
|
35 | 32 | import java.util.Collections;
|
36 |
| -import java.util.HashMap; |
37 | 33 | import java.util.HashSet;
|
38 | 34 | import java.util.List;
|
39 |
| -import java.util.Map; |
40 | 35 | import java.util.Set;
|
41 | 36 | import java.util.concurrent.CompletableFuture;
|
42 | 37 | import java.util.concurrent.ExecutionException;
|
|
96 | 91 | import io.snyk.languageserver.SnykLanguageServer;
|
97 | 92 | import io.snyk.languageserver.protocolextension.messageObjects.Diagnostic316;
|
98 | 93 | import io.snyk.languageserver.protocolextension.messageObjects.FeatureFlagStatus;
|
99 |
| -import io.snyk.languageserver.protocolextension.messageObjects.Fix; |
100 | 94 | import io.snyk.languageserver.protocolextension.messageObjects.FolderConfig;
|
101 | 95 | import io.snyk.languageserver.protocolextension.messageObjects.FolderConfigsParam;
|
102 | 96 | import io.snyk.languageserver.protocolextension.messageObjects.HasAuthenticatedParam;
|
@@ -457,26 +451,21 @@ public CompletableFuture<ShowDocumentResult> showDocument(
|
457 | 451 | return null;
|
458 | 452 | }
|
459 | 453 |
|
460 |
| - String scheme = uri.getScheme(); |
461 |
| - String filePath = uri.getPath(); |
462 |
| - String product = SnykUriUtils.getDecodedParam(uri, "product"); |
463 |
| - String action = SnykUriUtils.getDecodedParam(uri, "action"); |
464 |
| - String issueId = SnykUriUtils.getDecodedParam(uri, "issueId"); |
| 454 | + SnykUriDetails uriDetails = SnykUriDetails.fromURI(uri); |
465 | 455 |
|
466 | 456 | Issue issue;
|
467 |
| - if ("snyk".equals(scheme) && product.equals(DIAGNOSTIC_SOURCE_SNYK_CODE) |
468 |
| - && "showInDetailPanel".equals(action)) { |
469 |
| - issue = getIssueFromCache(filePath, issueId); |
| 457 | + if (uriDetails.isValid()) { |
| 458 | + issue = getIssueFromCache(uriDetails.filePath(), uriDetails.issueId()); |
470 | 459 | } else {
|
471 | 460 | SnykLogger.logInfo(String.format(
|
472 | 461 | "Invalid URI: scheme=%s, product=%s, action=%s, issue=%s",
|
473 |
| - scheme, product, action, issueId)); |
| 462 | + uriDetails.scheme(), uriDetails.product(), uriDetails.action(), uriDetails.issueId())); |
474 | 463 | return super.showDocument(params);
|
475 | 464 | }
|
476 | 465 |
|
477 | 466 | if (issue == null) {
|
478 | 467 | SnykLogger.logInfo(String.format(
|
479 |
| - "Issue not found in the issueCache; issueId: %s", issueId)); |
| 468 | + "Issue not found in the issueCache; issueId: %s", uriDetails.issueId())); |
480 | 469 | return null;
|
481 | 470 | }
|
482 | 471 |
|
|
0 commit comments