Skip to content

Commit 314a52a

Browse files
authored
Merge pull request #197 from microsoftgraph/bugfix/delta-regex
fixes a bug where delta tokens would not be extracted properly
2 parents 717a84e + 063d2ef commit 314a52a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jacocoTestReport {
3030
}
3131

3232
jacoco {
33-
toolVersion = "0.8.7-SNAPSHOT" //https://github.com/gradle/gradle/issues/15038
33+
toolVersion = "0.8.7"
3434
}
3535

3636
spotbugsMain {

src/main/java/com/microsoft/graph/http/BaseDeltaCollectionRequest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ protected void addDeltaTokenOption(@Nonnull final String value, @Nonnull final S
8181
* ?token=thetoken (onedrive)
8282
* delta(token='thetoken') (formal OData function usage)
8383
*/
84-
private static Pattern pattern = Pattern.compile("(?i)(?>\\$?delta)?token=['\"]?([\\w-\\.]+)");
84+
private static Pattern pattern = Pattern.compile("(?>[$]?delta)?token=['\"]?([\\w\\-\\.]+)", Pattern.CASE_INSENSITIVE);
8585
/**
8686
* Gets the delta token from the delta link provided by the previous response
8787
* @param deltaLink the delta link provided by the previous request
@@ -91,9 +91,9 @@ protected void addDeltaTokenOption(@Nonnull final String value, @Nonnull final S
9191
protected String getDeltaTokenFromLink(@Nonnull final String deltaLink) {
9292
Objects.requireNonNull(deltaLink, "parameter deltaLink cannot be null");
9393
final Matcher matcher = pattern.matcher(deltaLink);
94-
if(matcher.matches()) {
94+
if(matcher.find()) {
9595
return matcher.group(1);
9696
}
97-
return "";
97+
return "";
9898
}
9999
}

0 commit comments

Comments
 (0)