diff --git a/build.gradle b/build.gradle index ef0a294a7..c3b2d1909 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ buildscript { - ext { springBootVersion = '2.2.4.RELEASE' - hibernateVersion = '5.11.0.Final' + ext { springBootVersion = '2.2.5.RELEASE' + hibernateVersion = '5.11.5.Final' httpClientVersion = '4.5.11' swaggerVersion = '2.9.2' } @@ -113,10 +113,10 @@ dependencies { // Spring - compile group: 'org.springframework', name: 'spring-test', version: '5.2.3.RELEASE' + compile group: 'org.springframework', name: 'spring-test', version: '5.2.4.RELEASE' // Jackson - compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate5', version: '2.9.8' + compile group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-hibernate5', version: '2.10.3' // Oracle compile group: 'com.oracle.ojdbc', name: 'ojdbc8', version: '19.3.0.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d7d569d31..0b0ca9712 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip diff --git a/src/main/java/com/viglet/shio/api/ShAPI.java b/src/main/java/com/viglet/shio/api/ShAPI.java index 1eb6ab8d1..57af2fb76 100644 --- a/src/main/java/com/viglet/shio/api/ShAPI.java +++ b/src/main/java/com/viglet/shio/api/ShAPI.java @@ -16,17 +16,11 @@ */ package com.viglet.shio.api; -import java.io.IOException; - -import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.api.errors.JGitInternalException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import com.viglet.shio.provider.storage.ShGitProvider; - import io.swagger.annotations.Api; /** @@ -41,9 +35,6 @@ public class ShAPI { @Autowired private ShAPIBean shAPIBean; - @Autowired - private ShGitProvider shGitProvider; - @GetMapping public ShAPIBean shApiInfo() { @@ -51,23 +42,4 @@ public ShAPIBean shApiInfo() { return shAPIBean; } - - @GetMapping("test") - public ShAPIBean testApi() { - - shAPIBean.setProduct("Test Api"); - - shGitProvider.cloneRepository(); - try { - shGitProvider.init(); - - shGitProvider.newItem("174a27fc-337d-49fb-91b5-129baada3d72"); - shGitProvider.pushToRepo(); - } catch (JGitInternalException | IOException | GitAPIException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return shAPIBean; - } - } diff --git a/src/main/java/com/viglet/shio/url/ShURLFormatter.java b/src/main/java/com/viglet/shio/url/ShURLFormatter.java index 23f747144..b9a0c3991 100644 --- a/src/main/java/com/viglet/shio/url/ShURLFormatter.java +++ b/src/main/java/com/viglet/shio/url/ShURLFormatter.java @@ -27,17 +27,31 @@ public class ShURLFormatter { public String format(String URL) { + // 1. Covert to Lowercase String formattedURL = URL.toLowerCase(); - formattedURL = formattedURL.replaceAll("&.+?;", " "); // kill entities + + // 2. Convert HTML Symbol Entities to space, for examples: € or ® + formattedURL = formattedURL.replaceAll("&.+?;", " "); + + // 3. Remove accents formattedURL = StringUtils.stripAccents(formattedURL); + + // 4. Convert dot to hyphen formattedURL = formattedURL.replaceAll("\\.", "-"); + + // 5. Remove all characters that are not a-z or 0-9 or space or _ or hyphen formattedURL = formattedURL.replaceAll("[^a-z0-9 _-]", ""); + + // 6. Convert one or more spaces to hyphen formattedURL = formattedURL.replaceAll("\\s+", "-"); + + // 7. If exist space or hyphen into start or and of string, will be removed formattedURL = StringUtils.strip(formattedURL, " -"); - if (formattedURL.endsWith("-json")) { + // 8. In 4. Convert dot to -, so I need rollback Folders that have .json in its name. + if (formattedURL.endsWith("-json")) formattedURL = formattedURL.replaceAll("-json$", ".json"); - } + return formattedURL; } }