Solid server ignores content type

未关闭
#925 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, nodejs
领域
backend

调研方向

首先,使用此 issue 中的请求和响应示例,跟踪 Solid 服务器如何处理文件名没有已识别扩展名的资源的 PUT 及后续 GET。使用 Content-Type image/jpeg 重现上传,并验证该资源是作为 image/jpeg 而不是 text/turtle 提供的,且其分类与上传的内容一致。

由索引模型根据 Issue 内容生成。

描述

I have tried to upload various images to my POD and at some point I named it "x-jpg" instead of "x.jpg". It turns out that the solid server uses the filename extention to detect content type instead of relying on the actual content type.

Here is an example PUT operation showing the name "...270-jpg" and the content-type "image/jpeg":

PUT https://elfisk.solid.community/public/solidrc/images/Billede-30-10-2018-20.01.20-1541949270-jpg HTTP/1.1
Host: elfisk.solid.community
Connection: keep-alive
Content-Length: 257876
authorization: Bearer XXX
Origin: https://localhost:5001
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
content-type: image/jpeg
Accept: */*
Referer: https://localhost:5001/Home/Models
Accept-Encoding: gzip, deflate, br
Accept-Language: da-DK,da;q=0.9,en-US;q=0.8,en;q=0.7,sv;q=0.6,nb;q=0.5
Cookie: connect.sid=XXX

Later on I do a GET on https://elfisk.solid.community/public/solidrc/images/ which returns the document below. You can see that ".jpg" files have type "jpeg:Resource" whereas the "-jpg" files does not.

@prefix : <#>.
@prefix im: <>.
@prefix ldp: <http://www.w3.org/ns/ldp#>.
@prefix terms: <http://purl.org/dc/terms/>.
@prefix XML: <http://www.w3.org/2001/XMLSchema#>.
@prefix st: <http://www.w3.org/ns/posix/stat#>.
@prefix jpeg: <http://www.w3.org/ns/iana/media-types/image/jpeg#>.

im:
    a ldp:BasicContainer, ldp:Container;
    terms:modified "2018-11-11T15:14:19Z"^^XML:dateTime;
    ldp:contains
        <Billede-30-10-2018-19.52.49-1541949020.jpg>,
        <Billede-30-10-2018-20.01.20-1541949270-jpg>;
    st:mtime 1541949259.98;
    st:size 4096.
<Billede-30-10-2018-19.52.49-1541949020.jpg>
    a jpeg:Resource, ldp:Resource;
    terms:modified "2018-11-11T15:10:11Z"^^XML:dateTime;
    st:mtime 1541949011.912;
    st:size 249480.
<Billede-30-10-2018-20.01.20-1541949270-jpg>
    a ldp:Resource;
    terms:modified "2018-11-11T15:14:22Z"^^XML:dateTime;
    st:mtime 1541949262.852;
    st:size 257876.

Later on the data browser goes beserk when you try to delete the "*-jpg" image as it is served as a turtle document:

GET https://elfisk.solid.community/public/solidrc/images/Billede-30-10-2018-20.01.20-1541949270-jpg HTTP/1.1

HTTP/1.1 200 OK
X-Powered-By: solid-server
Link: <Billede-30-10-2018-20.01.20-1541949270-jpg.acl>; rel="acl", <Billede-30-10-2018-20.01.20-1541949270-jpg.meta>; rel="describedBy", <http://www.w3.org/ns/ldp#Resource>; rel="type"
Content-Type: text/turtle
主要语言
JavaScript
星标
1.8k
派生
308
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

nodeSolidServer/node-solid-server 的其他 Issue

查看 nodeSolidServer/node-solid-server 的全部 Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。