mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
contentLength as string
This commit is contained in:
parent
ac5c66f0e9
commit
6282dbb5fc
@ -14,7 +14,7 @@ const file = {
|
||||
index: 0,
|
||||
url: 'https://hello.com',
|
||||
contentType: 'application/x-zip',
|
||||
contentLength: 100
|
||||
contentLength: '100'
|
||||
}
|
||||
|
||||
const ddo = ({
|
||||
|
@ -119,11 +119,9 @@ export default class AssetFile extends PureComponent<
|
||||
<ul key={index} className={styles.file}>
|
||||
{contentType || contentLength ? (
|
||||
<>
|
||||
<li>{cleanupContentType(contentType)}</li>
|
||||
<li>
|
||||
{contentType && cleanupContentType(contentType)}
|
||||
</li>
|
||||
<li>
|
||||
{contentLength && contentLength > 0
|
||||
{contentLength && contentLength !== '0'
|
||||
? filesize(contentLength)
|
||||
: ''}
|
||||
</li>
|
||||
|
@ -8,7 +8,7 @@ describe('Item', () => {
|
||||
url: 'https://hello.com/hello.zip',
|
||||
found: true,
|
||||
contentType: 'application/zip',
|
||||
contentLength: 10
|
||||
contentLength: '10'
|
||||
}
|
||||
const { container } = render(
|
||||
<Item item={item} removeItem={() => null} />
|
||||
@ -21,7 +21,7 @@ describe('Item', () => {
|
||||
url: 'https://hello.com/hello.zip',
|
||||
found: false,
|
||||
contentType: '',
|
||||
contentLength: 10
|
||||
contentLength: '10'
|
||||
}
|
||||
const { container } = render(
|
||||
<Item item={item} removeItem={() => null} />
|
||||
|
@ -11,7 +11,7 @@ const Item = ({
|
||||
url: string
|
||||
found: boolean
|
||||
contentType: string
|
||||
contentLength: number
|
||||
contentLength: string
|
||||
}
|
||||
removeFile(): void
|
||||
}) => (
|
||||
|
@ -14,7 +14,7 @@ const files = [
|
||||
url: 'https://hello.com',
|
||||
checksum: 'cccccc',
|
||||
checksumType: 'MD5',
|
||||
contentLength: 100,
|
||||
contentLength: '100',
|
||||
contentType: 'application/zip',
|
||||
resourceId: 'xxx',
|
||||
encoding: 'UTF-8',
|
||||
|
@ -42,9 +42,7 @@ export class UrlCheckRouter {
|
||||
result.found = true
|
||||
|
||||
if (headers['content-length']) {
|
||||
result.contentLength = parseInt(
|
||||
headers['content-length']
|
||||
) // convert to number
|
||||
result.contentLength = headers['content-length']
|
||||
}
|
||||
|
||||
// sometimes servers send content-range header,
|
||||
@ -54,7 +52,7 @@ export class UrlCheckRouter {
|
||||
!headers['content-length']
|
||||
) {
|
||||
const size = headers['content-range'].split('/')[1]
|
||||
result.contentLength = parseInt(size) // convert to number
|
||||
result.contentLength = size
|
||||
}
|
||||
|
||||
if (headers['content-type']) {
|
||||
|
Loading…
Reference in New Issue
Block a user