<!-- 
RSS generated by JIRA (9.12.2#9120002-sha1:301bf498dd45d800842af0b84230f1bb58606c13) at Sun Jan 12 11:50:32 UTC 2025

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Mojang Studios Jira</title>
    <link>https://bugs.mojang.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>    <build-info>
        <version>9.12.2</version>
        <build-number>9120002</build-number>
        <build-date>10-01-2024</build-date>
    </build-info>


<item>
            <title>[MC-291] Screenshots are treated as links in the console.</title>
                <link>https://bugs.mojang.com/browse/MC-291</link>
                <project id="10400" key="MC">Minecraft: Java Edition</project>
                    <description>&lt;p&gt;When saving a screenshot then clicking on it in the console, Minecraft treats it as a link to a website and opens for e.g. literally &apos;2012-12-25_00.00.00.png&apos; in your default web browser.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What I excepted:&lt;/b&gt;&lt;br/&gt;
When clicking on the screenshot it should either open in your default image viewer with the path or in your default browser with the path and the &apos;file:///&apos; prefix.&lt;br/&gt;
&lt;b&gt;What happened:&lt;/b&gt;&lt;br/&gt;
Your default browser opens with the file name of the screenshot as the URL.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;To reproduce:&lt;/b&gt;&lt;br/&gt;
1. Pres F2 to take a screenshot.&lt;br/&gt;
2. Press &apos;t&apos; to open the console.&lt;br/&gt;
3. Click on the name of the screenshot. E.g &quot;Saved screenshot as &lt;em&gt;2012-12-25_00.00.00.png&lt;/em&gt;&quot;&lt;br/&gt;
4. &apos;2012-12-25_00.00.00.png&apos; opens as a URL in your default browser.&lt;/p&gt;</description>
                <environment>Windows 7 64bit, Java 7 (1.7.0_09)</environment>
        <key id="11549">MC-291</key>
            <summary>Screenshots are treated as links in the console.</summary>
                <type id="1" iconUrl="https://bugs.mojang.com/secure/viewavatar?size=xsmall&amp;avatarId=18903&amp;avatarType=issuetype">Bug</type>
                                    <status id="5" iconUrl="https://bugs.mojang.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="7">Invalid</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="5ives">5ives</reporter>
                        <labels>
                    </labels>
                <created>Thu, 25 Oct 2012 02:23:08 +0200</created>
                <updated>Thu, 21 Aug 2014 11:55:48 +0200</updated>
                            <resolved>Thu, 19 Sep 2013 00:18:10 +0200</resolved>
                                    <version>Minecraft 1.4.1</version>
                    <version>Minecraft 1.4.2</version>
                    <version>Minecraft 1.4.3</version>
                    <version>Minecraft 1.4.4</version>
                    <version>Minecraft 1.4.5</version>
                    <version>Snapshot 12w50b</version>
                    <version>Snapshot 13w03a</version>
                    <version>Minecraft 1.5</version>
                    <version>Snapshot 13w11a</version>
                    <version>Minecraft 1.5.1</version>
                    <version>Snapshot 13w16a</version>
                    <version>Minecraft 1.5.2</version>
                    <version>Snapshot 13w19a</version>
                    <version>Snapshot 13w21a</version>
                    <version>Minecraft 1.6.1</version>
                    <version>Minecraft 1.6.2</version>
                                    <fixVersion>Minecraft 13w37a</fixVersion>
                                                        <votes>7</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="104278" author="player_char" created="Wed, 18 Sep 2013 15:43:16 +0200"  >&lt;p&gt;Fixed for 13w37a. Now it is a link to your screenshot instead an internet link.&lt;/p&gt;</comment>
                            <comment id="89550" author="ezekielelin" created="Fri, 12 Jul 2013 00:46:40 +0200"  >&lt;p&gt;Confirmed for 1.6.2&lt;/p&gt;</comment>
                            <comment id="56432" author="banana478" created="Fri, 22 Mar 2013 23:20:57 +0100"  >&lt;p&gt;Confirmed.&lt;/p&gt;</comment>
                            <comment id="52062" author="dude" created="Tue, 12 Mar 2013 18:16:18 +0100"  >&lt;p&gt;Confirmed for 1.5pre&lt;/p&gt;</comment>
                            <comment id="49327" author="bugi74" created="Sun, 3 Mar 2013 13:23:50 +0100"  >&lt;p&gt;Affects 13w09c.&lt;/p&gt;</comment>
                            <comment id="49326" author="bugi74" created="Sun, 3 Mar 2013 13:23:36 +0100"  >&lt;p&gt;The bug here is that it thinks those are host names. The format is valid for one, but... perhaps it should exclude &apos;.png&apos; just to evade this issue.&lt;/p&gt;

&lt;p&gt;Then again, might as well detect those and convert them into file links. Bug fix and a decent feature in one change. Like this...&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Fix&lt;/b&gt;&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;ChatClickData&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    &lt;span class=&quot;code-comment&quot;&gt;// ADDED:
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; Pattern PATTERN_SCREENSHOT = Pattern.compile(&lt;span class=&quot;code-quote&quot;&gt;&quot;^\\d{4}-\\d{2}-\\d{2}_\\d{2}\\.\\d{2}\\.\\d{2}\\.png$&quot;&lt;/span&gt;);

    ...

    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; URI getURI() {
        &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; var1 = &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.getClickedUrl();

        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (var1 == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;

        &lt;span class=&quot;code-comment&quot;&gt;// ADDED:
&lt;/span&gt;        Matcher screenshotMatcher = PATTERN_SCREENSHOT.matcher(var1);
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (screenshotMatcher.matches()) {
            &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; match = screenshotMatcher.group(0);
            File mcDir = Minecraft.getMinecraftDir();
            &lt;span class=&quot;code-keyword&quot;&gt;try&lt;/span&gt; {
                mcDir = mcDir.getCanonicalFile();
            } &lt;span class=&quot;code-keyword&quot;&gt;catch&lt;/span&gt; (IOException e) {
                Logger.getLogger(&lt;span class=&quot;code-quote&quot;&gt;&quot;Minecraft&quot;&lt;/span&gt;).log(Level.SEVERE, &lt;span class=&quot;code-quote&quot;&gt;&quot;Spooky Minecraft home directory?&quot;&lt;/span&gt;, e);
                &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;;
            }
            File ssDir = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; File(mcDir, &lt;span class=&quot;code-quote&quot;&gt;&quot;screenshots&quot;&lt;/span&gt;);
            File ssFile = &lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; File(ssDir, match);
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; ssFile.toURI();
        }

        &lt;span class=&quot;code-comment&quot;&gt;// OLD STUFF CONTINUES...
&lt;/span&gt;        Matcher var2 = pattern.matcher(var1);
        ...

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Tested on 1.4.7. On my Windows 7, it opened the screenshot using IrfanView (my default viewer application), so couldn&apos;t have worked better. Note, the canonical-part is good to be; it removes possibly lingering \.\ stuff in the end etc., which if left there will cause trouble.&lt;/p&gt;

&lt;p&gt;Edit:&lt;br/&gt;
Clicking on screenshot when the confirmation dialog is enabled makes it a bit misleading, as the confirmation talks about websites. Own screenshots should be safe to click on at any time, so it is better to just skip the confirmation if the match is detected as a screenshot. This can be semi-exploited by someone else chatting a screenshot file name, which may or may not exist on the player&apos;s own computer, and the player clicking on that filename. But that would not cause a security vulnerability, merely a minor nuisance.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;ChatClickData&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;    &lt;span class=&quot;code-comment&quot;&gt;// ADDED METHOD
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;boolean&lt;/span&gt; isScreenshot() {
        &lt;span class=&quot;code-object&quot;&gt;String&lt;/span&gt; var1 = &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.getClickedUrl();
        &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (var1 == &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;)
            &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;false&lt;/span&gt;;
        Matcher screenshotMatcher = PATTERN_SCREENSHOT.matcher(var1);
        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; screenshotMatcher.matches();
    }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;GuiChat.mouseClicked()&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (var5 != &lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;) {
                &lt;span class=&quot;code-comment&quot;&gt;// ADDED THAT !isScreenshot() CHECK
&lt;/span&gt;                &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!var4.isScreenshot() &amp;amp;&amp;amp; &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.mc.gameSettings.chatLinksPrompt) {
                    &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.clickedURI = var5;
                    &lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;.mc.displayGuiScreen(&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt; GuiConfirmOpenLink(&lt;span class=&quot;code-keyword&quot;&gt;this&lt;/span&gt;, var4.getClickedUrl(), 0));
                } ...
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="12837" author="gravity" created="Thu, 25 Oct 2012 02:48:49 +0200"  >&lt;p&gt;The reason behind this is that URLs are relatively hard to accurately find in text. Minecraft, therefor, marks a lot more things as URLs than it actually should, which is better than the alternative which is sometimes not marking a URL at all, and possibly making someone frustrated. &lt;/p&gt;

&lt;p&gt;With that said, it may be possible to tag these as non-urls or maybe link them to a place on your hard drive instead of the net, because Minecraft generates these itself. I&apos;m not going to mark this as confirmed, though, because it&apos;s not really a bug.&lt;/p&gt;</comment>
                            <comment id="12811" author="craftthatblock" created="Thu, 25 Oct 2012 02:26:30 +0200"  >&lt;p&gt;This is normal. The picture path is linked up to the screenshot 000-00-00_00.00.00.png. Every file on your hard drive has a local URL. Not really a bug but could be improved.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10102">
                    <name>Duplicate</name>
                                                                <inwardlinks description="is duplicated by">
                                        <issuelink>
            <issuekey id="24833">MC-10855</issuekey>
        </issuelink>
            <issuelink>
            <issuekey id="46025">MC-26456</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                <customfield id="customfield_10701" key="com.atlassian.jira.plugin.system.customfieldtypes:datetime">
                        <customfieldname>CHK</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 17 Nov 2012 01:46:00 +0100</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10500" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Confirmation Status</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10303"><![CDATA[Confirmed]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_11700" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_11100" key="com.atlassian.jira.plugin.system.customfieldtypes:float">
                        <customfieldname>Linked</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_11600" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i0lz7j:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    </customfields>
    </item>
</channel>
</rss>