Internal Pages API: Source path should not have trailing "/"

When we built the internal Pages API (#28781 (closed)) we suffixed the source path with /

    def source
      {
        type: 'file',
        path: File.join(project.full_path, 'public/')
      }
    end

https://gitlab.com/gitlab-org/gitlab/blob/2a267e8cb7fd8a17a870c64f6b39ca9593d79f21/app/models/pages/lookup_path.rb#L24-28

This is different from what the legacy disk config source is doing. When using it Reader.resolvePath receives

gitlab-org/gitlab-org.127.0.0.1.xip.io/public

as value for the publicPath argument, while when using the gitlab config source it gets

gitlab-org/gitlab-org.127.0.0.1.xip.io/public/

which leads to error like

"gitlab-org/gitlab-org.127.0.0.1.xip.io/public" should be in "gitlab-org/gitlab-org.127.0.0.1.xip.io/public/"

and eventually to 404 Not Found - https://gitlab.com/gitlab-org/gitlab-pages/blob/266b942aba1f98c0548472542cfc6b7cec7a5f17/internal/serving/disk/reader.go#L71-112.

Not sure why we went with that trailing / bit looks like we need to remove it in order to match the disk source? It works fine and the pages are served when I remove it from the API response.

Edited Dec 10, 2019 by Krasimir Angelov
Assignee Loading
Time tracking Loading