Skip to content

Commit

Permalink
Merge pull request #2107 from ballerina-platform/fix-escape
Browse files Browse the repository at this point in the history
Handle identifier quote in path segment
  • Loading branch information
dulajdilshan authored Nov 25, 2024
2 parents 0f9c28f + 919520e commit c041a3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import java.util.concurrent.CompletableFuture;

import static io.ballerina.runtime.observability.ObservabilityConstants.KEY_OBSERVER_CONTEXT;
import static io.ballerina.stdlib.graphql.commons.utils.TypeUtils.removeEscapeCharacter;
import static io.ballerina.stdlib.graphql.runtime.engine.ArgumentHandler.getEffectiveType;
import static io.ballerina.stdlib.graphql.runtime.engine.EngineUtils.COLON;
import static io.ballerina.stdlib.graphql.runtime.engine.EngineUtils.GET_ACCESSOR;
Expand Down Expand Up @@ -117,7 +118,7 @@ public static Object executeSubscriptionResource(Environment environment, BObjec
ServiceType serviceType = (ServiceType) TypeUtils.getType(service);
for (ResourceMethodType resourceMethod : serviceType.getResourceMethods()) {
if (SUBSCRIBE_ACCESSOR.equals(resourceMethod.getAccessor()) &&
fieldName.getValue().equals(resourceMethod.getResourcePath()[0])) {
fieldName.getValue().equals(removeEscapeCharacter(resourceMethod.getResourcePath()[0]))) {
ArgumentHandler argumentHandler =
new ArgumentHandler(resourceMethod, context, fieldObject, responseGenerator, validation);
return getResultObject(environment, context, service, resourceMethod.getName(), argumentHandler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.util.Map;

import static io.ballerina.runtime.api.types.TypeTags.SERVICE_TAG;
import static io.ballerina.stdlib.graphql.commons.utils.TypeUtils.removeEscapeCharacter;
import static io.ballerina.stdlib.graphql.runtime.engine.Engine.RESOURCE_MAP;
import static io.ballerina.stdlib.graphql.runtime.engine.Engine.getDecodedSchema;
import static io.ballerina.stdlib.graphql.runtime.utils.Utils.ERROR_TYPE;
Expand Down Expand Up @@ -138,7 +139,7 @@ static boolean isPathsMatching(ResourceMethodType resourceMethod, List<String> p
}

for (int i = 0; i < resourcePath.length; i++) {
if (!resourcePath[i].equals(paths.get(i))) {
if (!removeEscapeCharacter(resourcePath[i]).equals(paths.get(i))) {
return false;
}
}
Expand Down

0 comments on commit c041a3d

Please sign in to comment.