JimmXinu / FanFicFare

FanFicFare is a tool for making eBooks from stories on fanfiction and other web sites.
Other
777 stars 165 forks source link

Content-Base url fetch may fail if another story linked in message body #700

Closed chocolatechipcats closed 3 years ago

chocolatechipcats commented 3 years ago

I dragged and dropped this message onto FFF:

From - Mon, 24 May 2021 19:41:58 GMT
X-Mozilla-Status: 0041
X-Mozilla-Status2: 00000000
X-Mozilla-Keys: mass_effect                                                                     
Received: by localhost; Mon, 24 May 2021 17:16:51 -0300
Date: Mon, 24 May 2021 19:41:58 GMT
Message-Id: <tag:archiveofourown.org,2005:Work/31504985@localhost.localdomain>
From: <a rel="author" href="/users/loquaciousquark/pseuds/loquaciousquark">loquaciousquark</a>
MIME-Version: 1.0
Subject: What We Live For
Content-Transfer-Encoding: 8bit
Content-Base: https://archiveofourown.org/works/31504985
Content-Type: text/html; charset=UTF-8

<html>
  <head>
    <title>What We Live For</title>
    <base href="https://archiveofourown.org/tags/15764730/feed.atom">
  </head>
  <body id="msgFeedSummaryBody" selected="false">
    <p>by <a rel="author" href="/users/loquaciousquark/pseuds/loquaciousquark">loquaciousquark</a></p><p>The thing about surviving certain death, it turns out, is that she has to keep on living afterwards. Mass Effect 3 and the Garrus romance through the eyes of a woman who can't stop long enough to die.</p>
<p>A companion piece to <a href="https://archiveofourown.org/works/22057702" rel="nofollow">The Thing About Dying</a>.</p><p>Words: 11620, Chapters: 1/1, Language: English</p><p>Series: Part 5 of <a href="https://archiveofourown.org/series/2131473">How to Hold a Hammer</a></p><ul><li>Fandoms: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/Mass%20Effect%20Trilogy/works">Mass Effect Trilogy</a></li><li>Rating: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/General%20Audiences/works">General Audiences</a></li><li>Warnings: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/No%20Archive%20Warnings%20Apply/works">No Archive Warnings Apply</a></li><li>Categories: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/F*s*M/works">F/M</a></li><li>Characters: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/Tali'Zorah%20nar%20Rayya/works">Tali'Zorah nar Rayya</a>, <a full_path="true" class="tag" href="https://archiveofourown.org/tags/James%20Vega/works">James Vega</a></li><li>Relationships: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/Female%20Shepard*s*Garrus%20Vakarian/works">Female Shepard/Garrus Vakarian</a></li><li>Additional Tags: <a full_path="true" class="tag" href="https://archiveofourown.org/tags/Romance/works">Romance</a>, <a full_path="true" class="tag" href="https://archiveofourown.org/tags/Vignette/works">Vignette</a>, <a full_path="true" class="tag" href="https://archiveofourown.org/tags/Friendship/works">Friendship</a></li></ul>
  </body>
</html>

I expected the URL fetcher to grab 31504985. Instead, it grabbed 22057702 linked in the message body. Is there a way to add priority to the content-base?

Thank you.

JimmXinu commented 3 years ago

There's already special code for Content-Base.

From what I've read, Content-Base is only for resolving relative URIs in the part(RFC2076). The message part then doesn't contain any relative story URLs, so it shouldn't matter for our purposes--it looks to me like the header is actually being misused.

Consequently, I'm disinclined to give it priority over the content of the message proper.

FYI, the Content-Base code only executes for a .eml file when the 'dragged' data type is also 'text/uri-list'--and then you should get both story URLs, if I read it correctly.

If its 'dragged' data type is 'text/uri-list', only the HTML is used--headers are ignored because FFF isn't aware it's a message vs an HTML block.

chocolatechipcats commented 3 years ago

I am not sure what happened, but when I tested again i couldn't replicate this—it instead pasted in both URLs, which is probably what would happen if it was also an email notification with standard hyperlinks. So I will close this.