Skip to content
This repository has been archived by the owner on Nov 20, 2024. It is now read-only.

Commit

Permalink
refactor: fix deepSource issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SidStraw committed Oct 12, 2023
1 parent 2d849e5 commit 9639cef
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions packages/karbon/src/runtime/routes/atom-desk.xml.ts
Original file line number Diff line number Diff line change
@@ -3,34 +3,20 @@ import { Feed } from 'feed'
import { encodePath, joinURL, withTrailingSlash } from 'ufo'
import path from 'pathe'
import { getDeskWithSlug } from '@storipress/karbon/internal'
import type { Author } from '../composables/page-meta'
import { listArticles } from '../api/article'
import { useRuntimeConfig } from '#imports'
import urls from '#sp-internal/storipress-urls.mjs'

interface TArticle {
title: string
id: string
link: string
description: string
content: string
date: Date
author: Author[]
plaintext: string
html: string
published_at: string
}

export default defineEventHandler(async (e) => {
setHeader(e, 'Content-Type', 'text/xml; charset=UTF-8')
if (!process.dev) setHeader(e, 'Cache-Control', 'max-age=600, must-revalidate')

const fileName = e.context.params?.slug || ''
const fileName = e.context.params?.slug ?? ''
if (!fileName.endsWith('.xml')) {
return sendNoContent(e, 404)
}

const slug = path.parse(fileName || '').name
const slug = path.parse(fileName).name
const desk = await getDeskWithSlug(slug)
if (!desk?.id) {
return sendNoContent(e, 404)

0 comments on commit 9639cef

Please sign in to comment.