Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the isPermaLink attribute to guid in RSS #107

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

yardenshoham
Copy link
Contributor

@yardenshoham yardenshoham commented Jan 10, 2024

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update
  • Go Version Update
  • Dependency Update

Description

Adds the optional attribute from the guid RSS spec: https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt

This is a breaking change to the RssItem struct as Guid is now a struct, not a string.

Related Tickets & Documents

Added/updated tests?

  • Yes
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

Run verifications and test

  • make verify is passing
  • make test is passing

Adds the optional attribute from the `guid` RSS spec: https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt

This is a breaking change to the `RssItem` struct as `Guid` is now a struct, not a string.

Signed-off-by: Yarden Shoham <[email protected]>
lunny pushed a commit to go-gitea/gitea that referenced this pull request Jan 20, 2024
…28860)

Our `guid` is not a valid URL so according to the RSS spec the
`isPermaLink` attribute needs to be set to `false`.

Example:
```diff
<item>
  <title>yardenshoham opened issue &lt;a href=&#34;https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2&#34;&gt;yardenshoham/test#2&lt;/a&gt;</title>
  <link>https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</link>
  <description>2#hey</description>
  <content:encoded><![CDATA[2#hey]]></content:encoded>
  <author>yardenshoham</author>
- <guid>355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
+ <guid isPermaLink="false">355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
  <pubDate>Tue, 16 Jan 2024 18:54:36 +0000</pubDate>
</item>
```

References:
-
https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt
- Fixes #28734
- gorilla/feeds#78
- #21550
- gorilla/feeds#107

Signed-off-by: Yarden Shoham <[email protected]>
yardenshoham added a commit to yardenshoham/gitea that referenced this pull request Jan 20, 2024
…o-gitea#28860)

Our `guid` is not a valid URL so according to the RSS spec the
`isPermaLink` attribute needs to be set to `false`.

Example:
```diff
<item>
  <title>yardenshoham opened issue &lt;a href=&#34;https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2&#34;&gt;yardenshoham/test#2&lt;/a&gt;</title>
  <link>https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</link>
  <description>2#hey</description>
  <content:encoded><![CDATA[2#hey]]></content:encoded>
  <author>yardenshoham</author>
- <guid>355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
+ <guid isPermaLink="false">355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
  <pubDate>Tue, 16 Jan 2024 18:54:36 +0000</pubDate>
</item>
```

References:
-
https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt
- Fixes go-gitea#28734
- gorilla/feeds#78
- go-gitea#21550
- gorilla/feeds#107

Signed-off-by: Yarden Shoham <[email protected]>
@AlexVulaj
Copy link
Member

Is there any way we could add this as a new property instead? I'd prefer to not introduce a breaking change if we can avoid it here.

@yardenshoham
Copy link
Contributor Author

I don't see how that would be possible, RssItem is serialized directly to XML so it would have to be a bigger change

@jaitaiwan
Copy link
Member

From what I read - the ask for this change is because some of the feeds generated by other providers doesn't meet the RSS 2.0 spec. Is there another spec that this library explicitly supports which this feature would fit under?

I'm less concerned about a breaking change and more concerned about if we're not meeting a spec. I think there's a case for if this is in one of the spec we explicitly support but we're not supporting it, that is a strong argument for a breaking change imho.

henrygoodman pushed a commit to henrygoodman/gitea that referenced this pull request Jan 31, 2024
…o-gitea#28860)

Our `guid` is not a valid URL so according to the RSS spec the
`isPermaLink` attribute needs to be set to `false`.

Example:
```diff
<item>
  <title>yardenshoham opened issue &lt;a href=&go-gitea#34;https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2&#34;&gt;yardenshoham/test#2&lt;/a&gt;</title>
  <link>https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</link>
  <description>2#hey</description>
  <content:encoded><![CDATA[2#hey]]></content:encoded>
  <author>yardenshoham</author>
- <guid>355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
+ <guid isPermaLink="false">355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
  <pubDate>Tue, 16 Jan 2024 18:54:36 +0000</pubDate>
</item>
```

References:
-
https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt
- Fixes go-gitea#28734
- gorilla/feeds#78
- go-gitea#21550
- gorilla/feeds#107

Signed-off-by: Yarden Shoham <[email protected]>
silverwind pushed a commit to silverwind/gitea that referenced this pull request Feb 20, 2024
…o-gitea#28860)

Our `guid` is not a valid URL so according to the RSS spec the
`isPermaLink` attribute needs to be set to `false`.

Example:
```diff
<item>
  <title>yardenshoham opened issue &lt;a href=&go-gitea#34;https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2&#34;&gt;yardenshoham/test#2&lt;/a&gt;</title>
  <link>https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</link>
  <description>2#hey</description>
  <content:encoded><![CDATA[2#hey]]></content:encoded>
  <author>yardenshoham</author>
- <guid>355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
+ <guid isPermaLink="false">355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
  <pubDate>Tue, 16 Jan 2024 18:54:36 +0000</pubDate>
</item>
```

References:
-
https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt
- Fixes go-gitea#28734
- gorilla/feeds#78
- go-gitea#21550
- gorilla/feeds#107

Signed-off-by: Yarden Shoham <[email protected]>
Copy link
Member

@jaitaiwan jaitaiwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Plan on merging and releasing as part of a new 1.x

@jaitaiwan
Copy link
Member

It appears there's no automated tests as a part of the CI. I'll test manually before merge and update if there are any test failures.

@jaitaiwan jaitaiwan merged commit eb2fb30 into gorilla:main Jun 17, 2024
1 check failed
rss.go Show resolved Hide resolved
wxiaoguang added a commit to go-gitea/gitea that referenced this pull request Jun 18, 2024
They merged the PR we waited for.

- Reference: gorilla/feeds#107
- Follows: #28860

Signed-off-by: Yarden Shoham <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
@yardenshoham yardenshoham deleted the issues/78 branch June 18, 2024 08:10
DennisRasey pushed a commit to DennisRasey/forgejo that referenced this pull request Jun 19, 2024
**Backport:** https://codeberg.org/forgejo/forgejo/pulls/4166

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/gorilla/feeds](https://github.com/gorilla/feeds) | require | minor | `v1.1.2` -> `v1.2.0` |

---

<details>
<summary>gorilla/feeds (github.com/gorilla/feeds)</summary>

[Compare Source](gorilla/feeds@v1.1.2...v1.2.0)

-   Add the `isPermaLink` attribute to `guid` in RSS by [@&#8203;yardenshoham](https://github.com/yardenshoham) in gorilla/feeds#107

-   [@&#8203;yardenshoham](https://github.com/yardenshoham) made their first contribution in gorilla/feeds#107

**Full Changelog**: gorilla/feeds@v1.1.2...v1.2.0

</details>

---

📅 **Schedule**: Branch creation - "before 4am" (UTC), Automerge - "before 4am" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MDkuMSIsInVwZGF0ZWRJblZlciI6IjM3LjQwOS4xIiwidGFyZ2V0QnJhbmNoIjoiZm9yZ2VqbyIsImxhYmVscyI6WyJkZXBlbmRlbmN5LXVwZ3JhZGUiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Ability to set isPermaLink="false" for guid [feature] isPermaLink="false" for guid field
4 participants