Invalid Atom feed on user activity when creating project
Summary
Creating a project introduces an <entry>
in the activity feed that creates an empty <summary>
node. tag <div> is missing in tag <summary>
RFC4287 pages 11 & 12 state that: It is advisable that each atom:entry element contain [...] a non-empty atom:summary element when the entry contains no atom:content element
RFC 4287 Atom Format December 2005
4.1.1.1. Providing Textual Content
Experience teaches that feeds that contain textual content are in
general more useful than those that do not. Some applications (one
example is full-text indexers) require a minimum amount of text or
(X)HTML to function reliably and predictably. Feed producers should
be aware of these issues. It is advisable that each atom:entry
element contain a non-empty atom:title element, a non-empty
atom:content element when that element is present, and a non-empty
atom:summary element when the entry contains no atom:content element.
Steps to reproduce
- Create a new project in your personal namespace
- Go to your personal page:
https://gitlab.com/<USER_NAME>
e.g. https://gitlab.com/sam.figueroa - Copy the feed URL in the top right with the RSS button
- Attempt to parse the feed, e.g. with this Ruby script
# frozen_string_literal: true
# Parse GitLab acitivty RSS feed
require 'rss'
require 'open-uri'
URL = "https://gitlab.com/<USER_NAME>.atom?feed_token=<FEED_TOKEN_WILL_BE_IN_URL>" # replace with the URL you copied from the RSS button
def parse_feed
rss = URI.open(URL)
feed = RSS::Parser.parse(rss)
rescue RSS::InvalidRSSError => e
puts "Invalid RSS feed detected"
puts e.message
puts e.backtrace
rss.rewind
puts rss.read
end
parse_feed
Example Project
n/a
What is the current bug behavior?
Produces feed entry with empty summary
node in entry
nodes
e.g.
<entry>
<id>tag:gitlab.com,2023-05-05:2573318417</id>
<link href="https://gitlab.com/sam.figueroa/activity_meter"/>
<title>Sam Figueroa created project Sam Figueroa / activity_meter</title>
<updated>2023-05-05T16:32:26Z</updated>
<media:thumbnail width="40" height="40" url="https://gitlab.com/uploads/-/system/user/avatar/9877149/avatar.png"/>
<author>
<username>sam.figueroa</username>
<name>Sam Figueroa</name>
<email></email>
</author>
<summary type="xhtml">
</summary>
</entry>
What is the expected correct behavior?
A valid atom feed being created with no-empty <summary>
nodes inside of entry
nodes.
e.g.
<entry>
<id>tag:gitlab.com,2023-05-05:2573318417</id>
<link href="https://gitlab.com/sam.figueroa/activity_meter"/>
<title>Sam Figueroa created project Sam Figueroa / activity_meter</title>
<updated>2023-05-05T16:32:26Z</updated>
<media:thumbnail width="40" height="40" url="https://gitlab.com/uploads/-/system/user/avatar/9877149/avatar.png"/>
<author>
<username>sam.figueroa</username>
<name>Sam Figueroa</name>
<email></email>
</author>
<summary type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml">
New project Sam Figueroa / activity_meter created.
</div>
</summary>
</entry>
Relevant logs and/or screenshots
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true
)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true
)(we will only investigate if the tests are passing)
Possible fixes
Code where summary is generated: https://gitlab.com/gitlab-org/gitlab/-/blame/master/app/views/events/_event.atom.builder#L26-30