Skip to content

Commit

Permalink
Avoid crash when url are wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
prof18 committed Oct 8, 2024
1 parent df457eb commit 4014f7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import com.prof18.feedflow.core.model.FeedSource
import com.prof18.feedflow.core.model.FeedSourceCategory
import com.prof18.feedflow.db.Search
import com.prof18.feedflow.shared.domain.DateFormatter
import com.prof18.feedflow.shared.utils.sanitizeUrl

internal fun Search.toFeedItem(dateFormatter: DateFormatter, removeTitleFromDesc: Boolean) = FeedItem(
id = url_hash,
url = url,
url = sanitizeUrl(url),
title = title,
subtitle = subtitle?.let { desc ->
val title = title
Expand Down Expand Up @@ -48,6 +49,6 @@ internal fun Search.toFeedItem(dateFormatter: DateFormatter, removeTitleFromDesc
null
},
isRead = is_read,
commentsUrl = comments_url,
commentsUrl = comments_url?.let { sanitizeUrl(it) },
isBookmarked = is_bookmarked,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import com.prof18.feedflow.core.model.FeedSource
import com.prof18.feedflow.core.model.FeedSourceCategory
import com.prof18.feedflow.db.SelectFeeds
import com.prof18.feedflow.shared.domain.DateFormatter
import com.prof18.feedflow.shared.utils.sanitizeUrl

internal fun SelectFeeds.toFeedItem(dateFormatter: DateFormatter, removeTitleFromDesc: Boolean) = FeedItem(
id = url_hash,
url = url,
url = sanitizeUrl(url),
title = title,
subtitle = subtitle?.let { desc ->
val title = title
Expand Down Expand Up @@ -48,6 +49,6 @@ internal fun SelectFeeds.toFeedItem(dateFormatter: DateFormatter, removeTitleFro
null
},
isRead = is_read,
commentsUrl = comments_url,
commentsUrl = comments_url?.let { sanitizeUrl(it) },
isBookmarked = is_bookmarked,
)

0 comments on commit 4014f7c

Please sign in to comment.