File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed
frontend/src/main/scala/bloop/bsp Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change 1
1
package bloop .bsp
2
2
3
3
import java .net .URI
4
- import java .net .URLDecoder
5
- import java .nio .charset .StandardCharsets
6
4
import java .nio .file .Path
7
5
8
6
import scala .util .Try
@@ -14,21 +12,16 @@ import bloop.engine.State
14
12
import bloop .io .AbsolutePath
15
13
16
14
object ProjectUris {
15
+ private val queryPrefix = " id="
17
16
def getProjectDagFromUri (projectUri : String , state : State ): Either [String , Option [Project ]] = {
18
17
if (projectUri.isEmpty) Left (" URI cannot be empty." )
19
18
else {
20
- val query = Try (new URI (projectUri).getRawQuery().split(" &" ).map(_.split(" =" ))).toEither
21
- query match {
22
- case Left (_) =>
19
+ Try (new URI (projectUri).getQuery()).toEither match {
20
+ case Right (query) if query.startsWith(queryPrefix) =>
21
+ val projectName = query.stripPrefix(queryPrefix)
22
+ Right (state.build.getProjectFor(projectName))
23
+ case _ =>
23
24
Left (s " URI ' ${projectUri}' has invalid format. Example: ${ProjectUris .Example }" )
24
- case Right (parsed) =>
25
- parsed.headOption match {
26
- case Some (Array (" id" , projectName)) =>
27
- val name = URLDecoder .decode(projectName, StandardCharsets .UTF_8 )
28
- Right (state.build.getProjectFor(name))
29
- case _ =>
30
- Left (s " URI ' ${projectUri}' has invalid format. Example: ${ProjectUris .Example }" )
31
- }
32
25
}
33
26
}
34
27
}
@@ -43,7 +36,7 @@ object ProjectUris {
43
36
existingUri.getHost,
44
37
existingUri.getPort,
45
38
existingUri.getPath,
46
- s " id= ${id}" ,
39
+ s " $queryPrefix ${id}" ,
47
40
existingUri.getFragment
48
41
)
49
42
}
You can’t perform that action at this time.
0 commit comments