My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 3719: commentlink should not be applied inside a link
2 people starred this issue and may be notified of changes. Back to list
Status:  AwaitingInformation
Owner:  ----


Sign in to add a comment
 
Reported by org...@gmail.com, Dec 9, 2015
Affected Version: 2.11

What steps will reproduce the problem?
1. In gerrit.config set the following:

[commentlink "commit"]
  match = \\b([0-9a-f]{8,40})
  link = "#/q/commit%3a$1"

2. In a comment or a commit message, add a link to http://some.server/path/commit/abc12345

What is the expected output? What do you see instead?
I'd expect the commentlink to *not* trigger in this case. Instead, a completely broken HTML is received:

<a href="http://some.server/path/commit/&lt;a href=" #="" q="" commit%3aabc12345"="">abc12345</a>" target="_blank"&gt;http://some.server/path/commit/<a href="#/q/commit%3aabc12345">abc12345</a>

I tried using negative lookbehind in the regexp[1], but then the change page doesn't open at all.

[1] (?<!/)\\b([0-9a-f]{8,40})
    Tried also escaping the / (with 1 or 2 backslashes). Didn't help.
Dec 21, 2015
Project Member #1 david.pu...@sonymobile.com
> I tried using negative lookbehind in the regexp[1], but then the change page doesn't open at all.

Do you see anything in the server side log or the browser's console log?  Javascript doesn't support negative lookbehind, as far as I know, so I'd expect that using it in a pattern would cause an exception somewhere.


Dec 21, 2015
Project Member #2 david.pu...@sonymobile.com
(No comment was entered for this change.)
Status: AwaitingInformation
Dec 21, 2015
#3 org...@gmail.com
One of my tries resulted in the following exception:

com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Cannot read file C:\Projects\gerrit\etc\gerrit.config

2) No implementation for java.lang.String annotated with interface com.google.gerrit.server.securestore.SecureStoreClassName was bound.
  at com.google.gerrit.pgm.util.SiteProgram$1.configure(SiteProgram.java:102)

2 errors
	at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:466)
	at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:155)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:107)
	at com.google.inject.Guice.createInjector(Guice.java:96)
	at com.google.inject.Guice.createInjector(Guice.java:73)
	at com.google.inject.Guice.createInjector(Guice.java:62)
	at com.google.gerrit.pgm.util.SiteProgram.createDbInjector(SiteProgram.java:129)
	at com.google.gerrit.pgm.Daemon.start(Daemon.java:276)
	at com.google.gerrit.pgm.Daemon.run(Daemon.java:205)
	at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:64)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:166)
	at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:93)
	at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:50)
	at Main.main(Main.java:25)
Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Cannot read file C:\Projects\gerrit\etc\gerrit.config
	at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:173)
	at com.google.gerrit.server.config.GerritServerConfigModule.getSecureStoreFromGerritConfig(GerritServerConfigModule.java:62)
	at com.google.gerrit.server.config.GerritServerConfigModule.getSecureStoreClassName(GerritServerConfigModule.java:39)
	at com.google.gerrit.pgm.util.SiteProgram.getConfiguredSecureStoreClass(SiteProgram.java:186)
	at com.google.gerrit.pgm.util.SiteProgram$1.configure(SiteProgram.java:102)
	at com.google.inject.AbstractModule.configure(AbstractModule.java:62)
	at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:340)
	at com.google.inject.spi.Elements.getElements(Elements.java:110)
	at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:138)
	at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:104)
	... 15 more
Caused by: org.eclipse.jgit.errors.ConfigInvalidException: Bad escape: /
	at org.eclipse.jgit.lib.Config.readValue(Config.java:1258)
	at org.eclipse.jgit.lib.Config.fromText(Config.java:1084)
	at org.eclipse.jgit.storage.file.FileBasedConfig.load(FileBasedConfig.java:161)
	... 24 more
Dec 21, 2015
Project Member #4 david.pu...@sonymobile.com
That seems to be a different issue. SecureStore initialisation fails when the gerrit.config file contains invalid content?

Sign in to add a comment

Powered by Google Project Hosting