Today I tried to set up my jigsaw-photo-stream project to use netlify large media with git-lfs.

What I failed to read was this key part of the netlify documentation:

Files tracked with Large Media are uploaded directly to the Netlify Large Media storage service on push, completely bypassing the site build.


As part of the build process for the project I resize the images that are uploaded.
The netlify documentation suggests that you could use netlify’s image transformation to get around this but ideally I dont want the project to be tied into the service provider should I want to migrate to another static site host.

At this point I’d already set up git-lfs on the repo and my netlify builds were failing.
I found this link to remove git-lfs from an existing repo

The steps being:

1
git lfs uninstall

remove lfs stuff from .gitattributes

1
2
3
4
5
6
7
8
git lfs ls-files | sed -r 's/^.{13}//' > files.txt
while read line; do git rm --cached "$line"; done < files.txt
while read line; do git add "$line"; done < files.txt
git add .gitattributes
git commit -m "unlfs"
git push origin
git lfs ls-files
rm -rf .git/lfs

Comment and share

Today I was working on an API written in Laravel for a React Native app with another developer.

He was trying to make requests to the Laravel backend and told me he kept receiving a response with a http status code of 302. 3XX http status codes are redirection status codes.

It turned out that he had not set an accept header on the requests to the server that the app was making.

By default if you dont set a requests accept headers they default to Accept: */*. With those set laravel responds with a Content-Type of text/html.

For the purpose of this project every api response needs to return JSON.

We can achieve this really easily by using middleware to overwrite the Accept headers on the incoming request and setting them to application/json.

Continue reading
  • page 1 of 1
Author's picture

Talv Bansal

Full Stack Developer, Part Time Photographer


Head of Software Engineering


Remote