Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68801

Symbol framework doesn't work properly if plugin's artifactId contains word "plugin-"

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core
    • 2.362

      Symbol framework doesn't work properly if plugin's artifactId contains word "plugin-".

      Pattern of symbol framework

      <l:icon src="symbol-symbolName plugin-yourArtifactId" />

      Under the hood it uses this method Functions#extractPluginNameFromIconSrc which finds word starting with "plugin-" and then replaces all occurrences to "".

      For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

      <l:icon src="symbol-symbolName plugin-plugin-test" />

      and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only test will be left.

      So instead of searching image from plugin-test, it will be searching image from test which doesn't exist.

      Solution would be to use replaceFirst instead of replace in Functions#extractPluginNameFromIconSrc

          [JENKINS-68801] Symbol framework doesn't work properly if plugin's artifactId contains word "plugin-"

          Temirlan Dyussyumbayev created issue -
          Temirlan Dyussyumbayev made changes -
          Description Original: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.
          New: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.
          Temirlan Dyussyumbayev made changes -
          Description Original: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.
          New: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.

           

          I would suggest to:
           # After finding first occurrence of "plugin-" replacing only first 7 characters.
           # Or it would be better to find occurrence with " plugin-" (with space) and then replacing only first 7 characters, so If our *symbolName* will contain "plugin-", it will be ignored and not replaced. (For instance, if we have such pattern {{<l:icon src="symbol-plugin-symbol plugin-plugin-test-ui" />, it will only remove " plugin-" instead of 3 occurrences.}}
          Temirlan Dyussyumbayev made changes -
          Description Original: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.

           

          I would suggest to:
           # After finding first occurrence of "plugin-" replacing only first 7 characters.
           # Or it would be better to find occurrence with " plugin-" (with space) and then replacing only first 7 characters, so If our *symbolName* will contain "plugin-", it will be ignored and not replaced. (For instance, if we have such pattern {{<l:icon src="symbol-plugin-symbol plugin-plugin-test-ui" />, it will only remove " plugin-" instead of 3 occurrences.}}
          New: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.

           

          I would suggest to:
           # After finding first occurrence of "plugin-" replacing (substring instead of replace in java code) only first 7 characters.
           # Or it would be better to find occurrence with " plugin-" (with space) and then replacing only first 7 characters, so If our *symbolName* will contain "plugin-", it will be ignored and not replaced. (For instance, if we have such pattern {{<l:icon src="symbol-plugin-symbol plugin-plugin-test-ui" />, it will only remove " plugin-" instead of 3 occurrences.}}
          Temirlan Dyussyumbayev made changes -
          Description Original: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.

           

          I would suggest to:
           # After finding first occurrence of "plugin-" replacing (substring instead of replace in java code) only first 7 characters.
           # Or it would be better to find occurrence with " plugin-" (with space) and then replacing only first 7 characters, so If our *symbolName* will contain "plugin-", it will be ignored and not replaced. (For instance, if we have such pattern {{<l:icon src="symbol-plugin-symbol plugin-plugin-test-ui" />, it will only remove " plugin-" instead of 3 occurrences.}}
          New: Symbol framework doesn't work properly if plugin's artifactId contains word "{*}plugin-{*}".

          Pattern of [symbol framework|https://weekly.ci.jenkins.io/design-library/Symbols/#:~:text=%3Cl%3Aicon%20src%3D%22symbol%2DsymbolName%20plugin%2DyourArtifactId%22%20/%3E]: 

          {{<l:icon src="symbol-symbolName plugin-yourArtifactId" />}}

          Under the hood it uses this method [Functions#extractPluginNameFromIconSrc|https://github.com/jenkinsci/jenkins/blob/master/core/src/main/java/hudson/Functions.java#:~:text=(%22%20%22)%3B-,for%20(String%20element%20%3A%20arr)%20%7B,%7D,-return%20%22%22%3B] which finds word starting with "plugin-" and then replaces all occurrences to "".

          For instance, if your plugin's artifactId will be plugin-test, the pattern will look like:

          {{<l:icon src="symbol-symbolName plugin-plugin-test" />}}

          and then Functions#extractPluginNameFromIconSrc will replace both "plugin-" occurrences with "" and only *test* will be left.

          So instead of searching image from {*}plugin-test{*}, it will be searching image from *test* which doesn't exist.

          Solution would be to use replaceFirst instead of replace in Functions#extractPluginNameFromIconSrc
          Alexander Brandes made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Alexander Brandes made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Alexander Brandes made changes -
          Remote Link New: This issue links to "https://github.com/jenkinsci/jenkins/pull/6902 (Web Link)" [ 27995 ]
          Mark Waite made changes -
          Released As New: 2.362
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Closed [ 6 ]
          Temirlan Dyussyumbayev made changes -
          Labels New: lts-candidate

            Unassigned Unassigned
            bzzitsme Temirlan Dyussyumbayev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: