Commit e890f8e6 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

allow localhost urls

parent a4409a4c
Pipeline #19962 passed with stage
in 13 minutes and 2 seconds
......@@ -29,7 +29,7 @@ public class PluginRestImpl extends BaseRestImpl {
public Map<String, Object> createPlugin(String hash, String name, String version, String url, boolean isPublic) throws QueryException {
if (!UrlValidator.getInstance().isValid(url)) {
if (!new UrlValidator(UrlValidator.ALLOW_LOCAL_URLS).isValid(url)) {
throw new QueryException("Invalid url: " + url);
Plugin plugin = pluginDao.getByHash(hash);
......@@ -137,6 +137,24 @@ public class PluginControllerIntegrationTest extends ControllerIntegrationTest {
assertEquals(1, pluginDao.getAll().size());
public void createPluginWithLocalUrl() throws Exception {
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("hash", "x"),
new BasicNameValuePair("name", "x"),
new BasicNameValuePair("version", "x"),
new BasicNameValuePair("isPublic", "false"),
new BasicNameValuePair("url", "http://localhost:8080/test/highlight-something.js"))));
RequestBuilder request = post("/plugins/")
assertEquals(1, pluginDao.getAll().size());
@Ignore("API has changed. The user parameter is now implicit, therefor this call is not handled by the servlet.")
public void setAndGetPluginData() throws Exception {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment